Prev: Question on 'solve' function and symlinks
Next: Update
From: Ismael Ochoa on 17 Jul 2010 09:40 I wrote the following file to solve DAE with ode15s. the value of "A" changes during at 3 s.But, I can not see the transient just in the variable x(:,4). why?: function SDAEPP2 clear all; close all; clc A=0.2; x0=zeros(4,1); x0(4) = 1; %V3 M=diag([1 1 0 0]); options=odeset('Mass',M); tspan=[0 3]; events = 0; [t,x]=ode15s(@DAEpscad2,tspan,x0,options); %% A=0.4; tspan=[3 5]; events = [events 1]; nout=length(t); x0=x(nout,:); htry=t(end)-t(end-1); [tsg,xsg]=ode15s(@DAEpscad2,tspan,x0,odeset(options,'InitialStep',htry)); t=[t;tsg]; x=[x;xsg]; subplot (231) ; plot(t,x(:,1)*180/pi); grid on; title('x1: delta 2'); subplot (232) ; plot(t,x(:,2)); grid on; title('x2: W(t)'); subplot (233) ; plot(t,x(:,3)*180/pi); grid on; title('x3: delat 3'); subplot (234) ; plot(t,x(:,4)); grid on; title('x4: V3'); function dxdt=DAEpscad2(t,x) ZBac=345^2/100; V2=382.8672/345; V1=0.6235; d1=0; ZL=1j*(A*2*pi*50)/ZBac; %Matriz [Y] y13=1/ZL; y31=1/ZL; Y11=y13; Y12=0; Y13=-y13; Y21=0; Y22=25.843-1j*96.1397 ; Y23=-25.843 + 1j*96.139; Y31=-y31; Y32=-25.843+1j*96.139; Y33=25.843 - 1j*96.139+y31; YF=[Y11 Y12 Y13 Y21 Y22 Y23 Y31 Y32 Y33]; Y=abs(YF); th=angle(YF); Pm0=2.285911; H = 3; D = 0.25; wB=2*pi*50; dxdt = zeros(4,1); dxdt(1) = x(2); dxdt(2) = wB/(2*H) * ( Pm0 - (V2^2*Y(2,2) * cos(th(2,2)) + V2 * x(4)* Y(2,3) * cos(th(2,3)+x(3)-x(1))) - D * x(2)); dxdt(3) = + V1 * x(4) * Y(3,1) * cos(th(3,1) + d1 - x(3))... + x(4) * V2 * Y(3,2) * cos(th(3,2) + x(1) - x(3)) + x(4)^2 * Y(3,3) * cos(th(3,3)); dxdt(4) = - x(4) * V1 * Y(3,1) * sin(th(3,1)+d1-x(3)) - x(4) *V2 * Y(3,2) * sin(th(3,2) + x(1) - x(3)) -x(4)^2 * Y(3,3) * sin(th(3,3)); end end
|
Pages: 1 Prev: Question on 'solve' function and symlinks Next: Update |