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

2 Ansichten (letzte 30 Tage)
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

Antworten (0)

Kategorien

Mehr zu Numerical Integration and Differential Equations finden Sie in Help Center und File Exchange

Produkte


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by