HELP to correct the codes of the graph of the solution of the differential equation with piecewise constant argument at Matlab

조회 수: 3 (최근 30일)
clc; clear; clear all;
a=1.5;
d0=1;
v0=1;
nu=sqrt(2.5);
sumxx=[];
k=250;
for p=1:k
T=linspace(0.25.*(p-1),0.25.*p,100);
sumx=d0.*cos(nu.*T)+(v0./nu).*sin(nu.*T)+((a.*d0)./nu.^2).*(1-cos(nu.*T));
for n=0:p-2
K=OMEGAm(a,n,nu,v0,d0).*(1-cos(nu.*(T-(0.25.*(n+1)))));
sumx=sumx+(a./nu.^2).*K;
end
% sumx=sumx.*x0;
sumxx=[sumxx,sumx];
clear sumx
end
tt=linspace(0,k,k*100);
plot(tt,sumxx)
xlabel('t')
ylabel('x(t)')
grid on
hold on
----------------------------------------------------------------
function w=OMEGAm(a,n,nu,v0,d0)
M=[(1-a./(nu.^2)).*cos(nu.*0.25)+a./(nu.^2) sin(nu.*0.25)./nu;-nu.*(1-a./(nu.^2)).*sin(nu.*0.25) cos(nu.*0.25)];
w=[(1-a./(nu.^2)).*cos(nu.*0.25)+a./(nu.^2)-1 sin(nu.*0.25)./nu]*(M.^n)*[d0;v0];
end

답변 (0개)

카테고리

Help CenterFile Exchange에서 Numerical Integration and Differential Equations에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by