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

5 views (last 30 days)
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)

Answers (1)

Walter Roberson
Walter Roberson on 14 Sep 2016
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 Comments
Raymond Charoen
Raymond Charoen on 14 Sep 2016
Edited: Walter Roberson on 14 Sep 2016
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)

Sign in to comment.

Tags

Community Treasure Hunt

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

Start Hunting!