coding equation to m file
Ältere Kommentare anzeigen
hey everyone a friend of mine help me with an equation and it work fine just i try to change it a litle but im not able there is out put, R value and X. x axis here is R but i want to change it to X exaclt viceversa with what you are seein here
please help me with
%%% ====== input values =========
U = 12;
% R = 2; % change from R=0,1,2,3
L = [2200e-6; 2.9e-3; 3.8e-3]; % change from 0.0022 to 0.0045 in mH
frequency = 400; % in Hz, maybe 50Hz.
fi = pi/3;
Er = 8;
ksi = 0.1;
Xv = 2*pi*frequency*L; % ‘X’ is now vector ‘Xv’
r = [];
y = [];
Rv = 0:0.1:3; % ‘R’ is now vector ‘Rv’
figure
hold all
for k1 = 1:numel(Xv)
X = Xv(k1); % ‘X’ is an element of ‘Xv’ in each loop iteration
for k2 = 1:numel(Rv)
R = Rv(k2);
r(k1,k2) = R;
a = exp((R/X)*(pi/3));
k = R/X;
alfa = atan(X/R);
alfa1 = alfa*0.017;
output = -R*U*(1+a)^2*exp(-k*(fi-pi/3))/(3*X^2*(1+a^3))+Er*sin(fi-ksi-alfa1)/sqrt(R^2+X^2);
y(k1,k2) = output;
end
plot (r(k1,:), y(k1,:))
OutpLeg{k1} = sprintf('Output L = %.1f mH', L(k1)*1000);
end
hold off
legend(OutpLeg)
xlabel('R'), ylabel('output')
title('gragh R\_output')
Antworten (1)
moji abb
am 11 Okt. 2019
0 Stimmen
8 Kommentare
darova
am 14 Okt. 2019
What is the difference?
moji abb
am 14 Okt. 2019
darova
am 14 Okt. 2019
What if just switch
% plot (r(k1,:), y(k1,:))
plot (y(k1,:), r(k1,:))
And change labels
ylabel('R'), xlabel('output')
moji abb
am 14 Okt. 2019
darova
am 14 Okt. 2019
Still unclear, can you please try again to explain?
moji abb
am 14 Okt. 2019
darova
am 14 Okt. 2019
You mean letter? Label?
xlabel('X')
moji abb
am 14 Okt. 2019
Kategorien
Mehr zu Deep Learning Toolbox finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
