Hi, I'm trying to plot an output using Stem(). I solved for my transfer function symbolically, from my expected output in the time domain. I'm not sure how to go back to doing things numerically once I have all of my functions figured out.
I keep getting the errors:
Error using stem (line 40)
DOUBLE cannot convert the input expression into a double array.
Error in prog (line 30)
stem(t,y)
Ideally this should spit out a dirac comb with a period of omega. I'm still relatively new to Matlab, so any help would be appreciated! This is also a very rough version of the hopefully final code.
close all; clear all; clc;
syms t omega n A s lambda;
func = dirac(t - n*((2*pi)/omega));
y = symsum(func,n,0,10);
Y = laplace(y);
x = A*cos(omega*t)*exp(-lambda*t);
X = laplace(x);
H = piecewise(omega < 0, ((lambda + s)^2 + omega^2)/(A*(lambda + s)), 0 <= omega, (((lambda + s)^2 +...
omega^2)*(exp(-(2*pi*s)/omega) + exp(-(4*pi*s)/omega) + exp(-(6*pi*s)/omega) + exp(-(8*pi*s)/omega) +...
exp(-(10*pi*s)/omega) + exp(-(12*pi*s)/omega) + exp(-(14*pi*s)/omega) + exp(-(16*pi*s)/omega) +...
exp(-(18*pi*s)/omega) + exp(-(20*pi*s)/omega) + 1))/(A*(lambda + s)));
h = ilaplace(H);
y = ilaplace(X*H);
A = 5;
omega = 5;
lambda = 1;
t = linspace(0,20);
idx = y == Inf;
y(idx) = 1;
stem(t,y)
ylim([-.02 1.5])
xlabel('time')
ylabel