Why my imaginary graph is straight line?
1 view (last 30 days)
Show older comments
Muhammad Na'imullah Fairul Nizam
on 24 Oct 2021
Commented: Muhammad Na'imullah Fairul Nizam
on 8 Nov 2021
clc
clear
close all
syms t s I1 I2
% KVL equations
KVL1 = (2*s^2+s+1)*I1-(s+1)*I2 == 1;
KVL2 = (s+1)*I1-(s^2+4*s+1)*I2 == 2;
Eqns = [KVL1 KVL2] ;
Vars = [I1 I2] ;
% Solving equations
Soln = solve(Eqns,Vars) ;
I1(s) = Soln.I1 ;
I2(s) = Soln.I2 ;
% Finding i1(t) and i2(t) using Inverse Laplace Transform
i1(t) = ilaplace(I1(s),s,t) ;
i2(t) = ilaplace(I2(s),s,t) ;
figure
subplot(2,1,1)
fplot(t,real(i1(t)),'LineWidth',1.5)
xlabel('t')
ylabel('Re[i_1(t)]')
title('Real Part of i_1(t)')
grid on
subplot(2,1,2)
fplot(t,imag(i1(t)),'LineWidth',1.5)
xlabel('t')
ylabel('Im[i_1(t)]')
title('Imaginary Part of i_1(t)')
grid on
figure
subplot(2,1,1)
fplot(t,real(i2(t)),'LineWidth',1.5)
xlabel('t')
ylabel('Re[i_2(t)]')
title('Real Part of i_2(t)')
grid on
subplot(2,1,2)
fplot(t,imag(i2(t)),'LineWidth',1.5)
xlabel('t')
ylabel('Im[i_2(t)]')
1 Comment
John D'Errico
on 24 Oct 2021
I'm sorry, but this needs to be said. If it is imaginary, then just pretend it is curved. :)
Answers (1)
John D'Errico
on 24 Oct 2021
fplot(t,imag(i1(t)),'LineWidth',1.5)
To my eyes, this does not look straight. But then I may need new glasses.
See Also
Categories
Find more on Linear Algebra in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!