Clear Filters
Clear Filters

I am facing problems in solving this question... I put my code .. please help

2 views (last 30 days)
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 Comment
Walter Roberson
Walter Roberson on 8 Jun 2021
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?

Sign in to comment.

Answers (1)

Sulaymon Eshkabilov
Sulaymon Eshkabilov on 8 Jun 2021
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)

Community Treasure Hunt

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

Start Hunting!