I am facing problems in solving this question... I put my code .. please help
1 次查看(过去 30 天)
显示 更早的评论
I am facing problems in solving this question .. I will put my code and please help me to correct my working
Consider the following Differential Equation
diff(y,t,2) + A*diff(y,t) + B == C + 5*cos(1500*t)
A-Solve it (write code) for t≥0 using zero initial conditions.
B- Determine the response of the LTI systems for the given input and initial conditions: y (0)= 0, dy/dt(0) =A
A=3 B=4 C=4
syms t y(t) %symbolic variable
A = 3; B = 4; C = 4;
ode = diff(y,t,2) + A*diff(y,t) + B == C + 5*cos(1500*t); %given eqn
con1 = y(0) == 0; %y(0)
Dy(t) = diff(y,t); %y'(t)
con2 = Dy(0) == 3; %y'(0)
solution = dsolve(ode,[con1 con2]) %output y(t)
digits(3); %precision
simpleSolution = simplify(vpa(solution)) %simplified representation
fplot(solution, [0 20])
hold on
fplot(Dy(t), [0 20])
hold off
xlabel("t ->");ylabel("y(t) ->");title("Output");
1 个评论
Walter Roberson
2021-6-8
You seem to have already solved the first part?
It is not clear to me which LTI system is being referred to for the second part?
回答(1 个)
Sulaymon Eshkabilov
2021-6-8
What are the LTI system and the input signal ?
LTI system simulation can be done easily with: tf() and lsim(). Example:
A = 1; B = 2; C = 3;
TF = tf(1, [A B C]); % LTI system: A*DDy + B*Dy + C*y = u(t)
t = linspace(0, 1, 2000);
u = cos(t);
[R, time] = lsim(TF, u, t);
plot(time, R)
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Symbolic Math Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!