Why is there an error using plot?

Here is my code, the graph shows nothing on it as it says there is an error using plot. Thanks for any help!
syms x
%converted to standard SI units (Newtons, Meters, rad)
L = 10;
E = 12000000000;
I = 0.001067;
w = 5000000;
y = (w/(24*E*I))*(x^4 - 4*L*(x^3) + 6*(L^2)*(x^2));
% let a=defelction, b=slope, c=moment, d=shear, e=load, ds=distance
a = y;
b = diff(y);
c = E*I*(diff(y,2));
d = E*I*(diff(y,3));
e = -E*I*(diff(y,4));
ds = linspace(0,10,0.25);
subplot(1,5,1)
plot(ds,a)
subplot(1,5,2)
plot(ds,b)
subplot(1,5,3)
plot(ds,c)
subplot(1,5,4)
plot(ds,d)
subplot(1,5,5)
plot(ds,e)

답변 (1개)

Walter Roberson
Walter Roberson 2021년 1월 27일

0 개 추천

You first argument to plot() is numeric. When the first argument to plot() is numeric, you are using the usual plot() function (not a method of a class such as plotting a graph()). When you plot() numeric, then the other arguments to plot() must be either numeric or character vectors such as line specifications or name/value pairs. However, a, b, c, d, e are all symbolic formulas, not numeric.
You have two choices:
fplot(a, [0 10])
or
plot(ds, double(subs(a,x,ds)))

카테고리

도움말 센터File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

질문:

2021년 1월 27일

답변:

2021년 1월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by