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

1 次查看(过去 30 天)
%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

采纳的回答

VBBV
VBBV 2022-12-5
%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 个评论
VBBV
VBBV 2022-12-5
编辑:VBBV 2022-12-5
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

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Calculus 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by