please can someone look at this code an find why my runge kutta code don't work at i expect(the coefficient are constant althought they schouldn't). )
Show older comments
if true
% code
function yprime = gsm2(t,y) drehz = y(1); strom = y(2); global k1 n1 nn Mn Jm Ra Re Oh p Jg D La
k1= 720;
n1=50;
Ui=[4.8 105 120 140 160 180 200 220 240 260 280 300 320 340 360 380 400 420 440]; %Induzierte Ankerspannung
Ie= [0 0.2 0.245 0.29 0.34 0.375 0.415 0.46 0.505 0.555 0.6 0.65 0.705 0.76 0.84 0.905 1 1.115 1.27]; %Erregerstrom
%Hauptpolwindungszahl
We= 952*2*p;
%--------------------------------------------------
%Fluss
%--------------------------------------------------
c= 1/(k1*n1);
PHI= c.*Ui; %Berechnung des Flusses % Phi= [0.0001 0.0029 0.0033 0.0039 0.0044 0.005 0.0056 0.0061 0.0067 0.0072 0.0078 0.0083 0.0089 0.0094 0.01 0.0106 0.0111 0.0117 0.0122];
ie=0.36;
phi=spline(Ie,PHI,ie); % PHI(Ie)-Kennlinie vom Fluss
%--------------------------------------------------
%Ableitung des Flusses
%--------------------------------------------------
i=1:18;
Phi= PHI(i+1)-PHI(i);
dIe= Ie(i+1)-Ie(i);
k= Phi./dIe;
PHi= [k 0.0035]; %Zuweisen einer zusätlichen Variable, sodass es kein Dimensionproblem bei der Benutzung von der Spline-Fkt gibt.
ie=0.36;
phI=spline(Ie,PHi,ie); % PHi(Ie)-Kennlinie der Ableitung des Flusses
%--------------------------------------------------
%DGL.-System 1. Ordnung des DC-Generators
%--------------------------------------------------
a = n1-y(1);
a1 = n1-nn;
a2 = k1*phi*y(2);
a3 = 2*pi*(Jg+Jm);
a4= (a./a1)*Mn;
a5= a2/(2*pi);
dndt = (a4-a5)/a3; % drehzprime = ((((n1-y(1,:))/(n1-nn))*Mn)-((k1*phi*y(2,:))/(2*pi)))/(2*pi*(Jg+Jm));
b= k1*phi*y(1);
b1= (Ra+Re)*y(2);
b2=(1+Oh)*We*phI;
b3= La+b2;
didt= (b-b1)/b3; % stromprime = ((k1*phi*y(1,:))-((Ra+Re)*y(2,:)))/(La+((1+Oh)*We*PHi));
yprime = [dndt; didt]; end
and the main to solve it is in the file. thx a lot
Answers (1)
kamdam Sophia
on 16 Apr 2015
Categories
Find more on General Applications 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!