How to check if two equations are equal
5 views (last 30 days)
Show older comments
Hello, I'm trying to verify if an equation is time-invariant or not time-invariant. So I'm putting two equations in a for loop to see if the values of each equation are equal. In theory, these values should be equal, but it is outputting, not time-invariant. Any help?
clear
syms t
x1(t)=cos(t);
y1(t)=1-2*x1(t-1);
x2(t)=cos(t-3);
y2(t)=1-2*x2(t-1);
for t=-pi():.1:pi()
Check_Y=y1(t-3);
Check_X=y2(t);
if Check_X~=Check_Y
disp('Not time invarient')
break
end
if t==-pi()+6.2
disp('Time invarient')
end
end
t=-pi():.1:pi();
figure
subplot(3,1,1)
plot(t,y1(t))
title('x(t):y(t)')
subplot(3,1,2)
plot(t,y2(t))
title('x(t-3):y(t)')
subplot(3,1,3)
plot(t,y1(t-3))
title('y(t-3)')
0 Comments
Accepted Answer
VBBV
on 5 Feb 2022
clear
syms t
x1(t)=cos(t);
y1(t)=1-2*x1(t-1);
x2(t)=cos(t-3);
y2(t)=1-2*x2(t-1);
for t=-pi():.1:pi()
Check_Y=vpa(y1(t-3),2);
Check_X=vpa(y2(t),2);
if Check_X~=Check_Y
disp('Not time invarient')
break
end
if t==-pi()+6.2
disp('Time invarient')
end
end
t=-pi():.1:pi();
figure
subplot(3,1,1)
plot(t,y1(t))
title('x(t):y(t)')
subplot(3,1,2)
plot(t,y2(t))
title('x(t-3):y(t)')
subplot(3,1,3)
plot(t,y1(t-3))
title('y(t-3)')
Try with vpa for check variables.
0 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!