Azzera filtri
Azzera filtri

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

1 visualizzazione (ultimi 30 giorni)
%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 Commento
TEOH CHEE JIN
TEOH CHEE JIN il 5 Dic 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.

Accedi per commentare.

Risposta accettata

VBBV
VBBV il 5 Dic 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 Commento
VBBV
VBBV il 5 Dic 2022
Modificato: VBBV il 5 Dic 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

Accedi per commentare.

Più risposte (0)

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by