how to normalize output for plotting
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
neil whitesell
am 2 Dez. 2020
Kommentiert: neil whitesell
am 4 Dez. 2020
hello, i need to figure out how to normalize the putput thats getting plotted (largest value being one, rest scaled etc.)
i'm sure there's a function for it, but the few i have tried i dont have on my matlab (things like normc() etc)
here is code, and i'll include some output as well. the variable named "normalizedvector" does in fact seem to be normalized, but i cannot get it to plot correctly
i am trying to plot the radiation pattern of a dipole, and what gets spit out dosent seem correct
clc
clear
close all
addpath c:\antennas\ewa
beta=12.5664; %
eta=377;
l=.68;
a=.00002;
ker='a';
basis='d';
d=.001;
e=2.7128 %math constant
E=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10000000,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
output = pfield(l,a,E,ker,basis)
R=100 %meter
theta=0
d=.001683
f=1
A=zeros(1,101);
%differing vertical distance
for theta=0:.15708:pi %.01745
for k=1:1:101
A(k)=0
end
for k=1:1:101 %i have 101 slices
k;
cur=abs(output(k)); %grabs abs current at certain iteration
x=R-d*cos(theta); %defines changing distnce to point
Efield=(((1i*beta*eta*cur))/(4*pi*R))*e^((-1i)*beta*x)*e^(1i*beta*d)*sin(theta);
A(k)=abs(Efield)
A
%theta=theta+tand(d);
d=.001683+(.003366*(k-1)); %this sets the first distance half a sample up, then one slice distance up thereafter
end
%o=sum(A)
normalizedvector = (A- min(A)) / (max(A)-min(A));
o=sum(A)
%S=sum(normalizedvector,'all')
l=sum(normalizedvector(f))
%l=normalizedvector(f);
polarplot(theta,o,'*');
hold on
f=f+1;
A
normalizedvector
end
hold off
normalizedvector =
Columns 1 through 15
0 0.0425 0.0849 0.1270 0.1690 0.2106 0.2518 0.2926 0.3328 0.3724 0.4114 0.4496 0.4870 0.5235 0.5591
Columns 16 through 30
0.5937 0.6272 0.6596 0.6909 0.7208 0.7495 0.7769 0.8028 0.8273 0.8504 0.8719 0.8918 0.9102 0.9269 0.9419
Columns 31 through 45
0.9553 0.9670 0.9769 0.9851 0.9915 0.9961 0.9989 1.0000 0.9993 0.9967 0.9924 0.9863 0.9785 0.9688 0.9575
Columns 46 through 60
0.9444 0.9296 0.9131 0.8950 0.8752 0.8539 0.8752 0.8950 0.9131 0.9296 0.9444 0.9575 0.9688 0.9785 0.9863
Columns 61 through 75
0.9924 0.9967 0.9993 1.0000 0.9989 0.9961 0.9915 0.9851 0.9769 0.9670 0.9553 0.9419 0.9269 0.9102 0.8918
Columns 76 through 90
0.8719 0.8504 0.8273 0.8028 0.7769 0.7495 0.7208 0.6909 0.6596 0.6272 0.5937 0.5591 0.5235 0.4870 0.4496
Columns 91 through 101
0.4114 0.3724 0.3328 0.2926 0.2518 0.2106 0.1690 0.1270 0.0849 0.0425 0
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Two y-axis finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!