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

10 ビュー (過去 30 日間)
Raymond Charoen
Raymond Charoen 2016 年 9 月 14 日
コメント済み: Walter Roberson 2016 年 9 月 14 日
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)
Walter Roberson
Walter Roberson 2016 年 9 月 14 日
yn = double( subs(y, symvar(y), tn)) ;

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeCalculus についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by