What does the error code "Error using plot Non-numeric data is not supported in 'Line'" mean?

5 次查看(过去 30 天)
For some reason I do not know why I am getting the error message below. I have provided my code below as well. Can someone help me figure out what this means and how I can plot the function y?
Error using plot Non-numeric data is not supported in 'Line'
numerator=[10.469*10^3 -5.79264*10^8];
denominator=[1 2.10858*10^4 5.23949*10^7];
[r p k]=residue(numerator,denominator)
syms s
A=5.0218e+04/(s-(-1.8208e+04))+(-3.9749e+04)/(s-(-0.2878e+04))
B=simplify(A)
y=ilaplace(B)
%Plot ilaplace output result
t=0:0.000001:0.002;
plot(t,y)

回答(1 个)

Walter Roberson
Walter Roberson 2016-9-14
Your y is a symbolic expression involving the symbolic variable t. When you assign a numeric value to a symbolic variable that was used previously, the expressions that used the symbolic variable do not pick up the new numeric value. You need to subs() the numeric values for the symbolic variable.
tn=0:0.000001:0.002;
yn = double( subs(y, t, tn)) ;
plot(tn, yn)
  2 个评论
Raymond Charoen
Raymond Charoen 2016-9-14
编辑:Walter Roberson 2016-9-14
I edited my code to reflect what you described, but when I try running my code, it says "Undefined function or variable 't'." I have included my code below.
numerator=[10.469*10^3 -5.79264*10^8];
denominator=[1 2.10858*10^4 5.23949*10^7];
[r p k]=residue(numerator,denominator)
syms s
A=5.0218e+04/(s-(-1.8208e+04))+(-3.9749e+04)/(s-(-0.2878e+04))
B=simplify(A)
y=ilaplace(B)
%Plot ilaplace output result
tn=0:0.000001:0.002;
yn = double( subs(y, t, tn)) ;
plot(tn,yn)

请先登录,再进行评论。

类别

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