Trouble with For Loop in Differential Equations

clear all
%Problem 1a
syms x(t) Fmag;
Dx=diff(x);
k=36;
Fmag=4*cos(4*t);
disp(['dx^2/d^2t +' num2str(k) 'x=' char(Fmag)])
x(t)=simplify(dsolve(diff(x,t,2)+k*x==Fmag,x(0)==0,Dx(0)==4));
dx(t)=diff(x(t));
%Problem 1b
fplot(x(t))
title('Graph of x(t)')
for zeros=dx(t)==0
x(zeros)
end
%Problem 2a
syms w Fmag2;
Fmag2=4*cos(w*t);
disp(['dx^2/d^2t +' num2str(k) 'x=' char(Fmag2)])
x(t)=dsolve(diff(x,t,2)+36*x==Fmag2,x(0)==0,Dx(0)==4);
%Problem 3
%syms x3(t);
c=2;
disp(['dx^2/d^2t +' num2str(c) 'dx/dt +' num2str(k) 'x=' char(Fmag)])
fplot(x(t))
title('Graph of x(t) for Problem 3')

Réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by