Why is there an error using plot?

5 次查看(过去 30 天)
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
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)))

类别

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