matlab out of memory problem

1 view (last 30 days)
I have tried reducing everything to fix the error, the code works fine until I add the receiver(rxs) to compute the coverage map. When i add rxs to coverage it says that matlab is out of memory. I am not very skilled in matlab and would like to practice until i get very good at it so any help would be greatly appreciated. Thanks in advance
clc;
close all;
clearvars;
f0 = 2.4e9;
ant = helix('Tilt',-360);
f = figure;
show(ant)
view(-220,30)
z = -15;
x = (-250:4:250)*1e3;
y = (-100:4:400)*1e3;
[X,Y] = meshgrid(x,y);
numpoints = length(x)*length(y);
points = [X(:)'; Y(:)'; z*ones(1,numel(X))];
E = EHfields(ant,f0,points); % Units: V/m
%Magnitude of Electric Field
Emag = zeros(1,numpoints);
for m=1:numpoints
Emag(m) = norm(E(:,m)/sqrt(2));
end
Emag = 20*log10(reshape(Emag,length(y),length(x))); % Units: dBV/m
Emag = Emag + 120; % Units: dBuV/m
%Plot of Antenna Electric Field
d_min = min(Emag(:));
d_max = max(Emag(:));
del = (d_max-d_min)/12;
d_vec = round(d_min:del:d_max);
if isvalid(f)
close(f)
end
figure
contourf(X*1e-3,Y*1e-3,Emag,d_vec,'showtext','on')
title('Field Strength (dB\muV/m) on flat Earth (1V tx)')
xlabel('lateral (km)')
ylabel('boresight (km)')
c = colorbar;
set(get(c,'title'),'string','dB\muV/m')
%Transmitter Site with Antenna
lat = -24.59;
lon = 25.89;
h = 15;
az = -150;
xyrot = wrapTo180(az - 90);
%Define a transmitter site with the antenna and orientation defined above.
tx = txsite('Name','Antenna Site', ...
'Latitude',lat, ...
'Longitude',lon, ...
'Antenna',ant, ...
'AntennaHeight',h, ...
'AntennaAngle',xyrot, ...
'TransmitterFrequency',f0);
names = "Fenway Park";
lats = -24.89;
lons = 25.87;
sens = -90;
rxs = rxsite("Name",names, ...
"Antenna",dipole,"Latitude",lats, ...
"Longitude",lons, ...
"ReceiverSensitivity",sens);
%show(rxs)
%Calculate Transmitter Power
Z = impedance(tx.Antenna,tx.TransmitterFrequency);
If = feedCurrent(tx.Antenna,tx.TransmitterFrequency);
Irms = norm(If)/sqrt(2);
Ptx = real(Z)*(Irms)^2;
tx.TransmitterPower = Ptx;
%Display Electric Field Coverage Map with Multiple Contours
% Launch Site Viewer with no terrain
%viewer = siteviewer("Terrain", "none");
sigStrengths = [9 14 19 24 29 36];
coverage(tx,rxs,'freespace', ...
'Type','efield', ...
'SignalStrengths',sigStrengths, ...
'Colormap','parula', ...
'ColorLimits',[9 36])
%Customize Site Viewer
viewer.Basemap = 'topographic';

Accepted Answer

Prateek
Prateek on 27 Dec 2022
Hello Gophela,
Thanks for sharing your code. I was able to execute it in my system, and it produced results without any error (screenshots depicted below).
This leads me to suspect that this issue is due to limited memory in the system you are using. Thus, upgrading to a system with higher memory is likely to resolve this issue at your end.
Hope this helps.
Regards,
Prateek
  1 Comment
Gophela Seiphepi
Gophela Seiphepi on 27 Dec 2022
Okay thank you very much Prateek I will run the script on a better system

Sign in to comment.

More Answers (0)

Categories

Find more on Satellite and Orbital Mechanics in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!