Unable to convert expression into double array.
3 次查看(过去 30 天)
显示 更早的评论
%¿COMO PUEDO DIBUJAR LA PARTE REAL E IMAGINARIA?
syms z w
Gz=z^2/(2*z-5);
Gjw=subs(Gz,z,j*w);
n=0:1:25
figure(1)
mod=abs(Gjw)%grafica la parte real
subplot(2,1,1)
stem(n,mod)
xlabel('frec (Hz)')
ylabel('MÓDULO')
phase=imag(Gjw) %grafica la parte imag
subplot(2,1,2)
stem(n,phase)
xlabel('frec (Hz)')
ylabel('ARGUMENTO')
sgtitle('G(jw)')
0 个评论
采纳的回答
Prachi Kulkarni
2022-2-15
Hi,
You haven’t substituted the symbol w with any value. That is why the substitution cannot generate a numeric value. Small changes to your code as shown below can solve the issue.
syms z w % w should not be variable
w = 0:1:25; % assigning some values to w of the same size as n
Gz=z^2/(2*z-5);
Gjw=double(subs(Gz,z,j*w)); % convert sym to double
n=0:1:25
figure(1)
mod=abs(Gjw)%grafica la parte real
subplot(2,1,1)
stem(n,mod)
xlabel('frec (Hz)')
ylabel('MÓDULO')
phase=imag(Gjw) %grafica la parte imag
subplot(2,1,2)
stem(n,phase)
xlabel('frec (Hz)')
ylabel('ARGUMENTO')
sgtitle('G(jw)')
0 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!