Why do I receive 'Error using sym>tomupad' in Line 6 when plotting impulse signal with right time shifting?

5 views (last 30 days)
%create symbolic functions x, a, b, c, d, e, f_c with independent variable t
syms x(t) a(t) h(t) b(t) c(t) d(t) e(t) f_c(t)
x(t) = cos(100*pi*t);
a(t) = x(0.4*t);
h(t) = stem([0]+0.02,[1]);
%plot signal x(t)
figure
fplot(x(t))
xlim([-0.5 0.5]),ylim([-2 2])
title ('Time domain of signal x(t)')
xlabel('Time, t')
ylabel('Amplitude, x(t)')
grid on
%plot signal h(t)
figure
fplot(h(t))
xlim([-0.5 0.5]),ylim([-2 2])
title ('Time domain of signal h(t)')
xlabel('Time, t')
ylabel('Amplitude, h(t)')
grid on
  1 Comment
TEOH CHEE JIN
TEOH CHEE JIN on 5 Dec 2022
When writting in mathematical expression, h(t) = 𝛿(t-0.02). I expect the impulse signal to shift right by 0.02 seconds after plotting it.

Sign in to comment.

Accepted Answer

VBBV
VBBV on 5 Dec 2022
%create symbolic functions x, a, b, c, d, e, f_c with independent variable t
syms x(t) a(t) h(t) b(t) c(t) d(t) e(t) f_c(t)
x(t) = cos(100*pi*t);
a(t) = x(0.4*t);
h = stem([0]+0.02,[1])
h =
Stem with properties: Color: [0 0.4470 0.7410] LineStyle: '-' LineWidth: 0.5000 Marker: 'o' MarkerSize: 6 MarkerFaceColor: 'none' BaseValue: 0 XData: 0.0200 YData: 1 Show all properties
%plot signal x(t)
figure
fplot(x(t))
xlim([-0.5 0.5]),ylim([-2 2])
title ('Time domain of signal x(t)')
xlabel('Time, t')
ylabel('Amplitude, x(t)')
grid on
%plot signal h(t)
% figure
% plot(h.XData,h.YData)
% % xlim([-0.5 0.5]),ylim([-2 2])
% title ('Time domain of signal h(t)')
% xlabel('Time, t')
% ylabel('Amplitude, h(t)')
% grid on
  1 Comment
VBBV
VBBV on 5 Dec 2022
Edited: VBBV on 5 Dec 2022
h = stem([0]+0.02,[1]) % stem returns the function handle structure
You are trying to plot function handle using fplot. instead access XData , YData from function handle and plot

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!