How can I plot this anonymous function?
Show older comments
w0 = 200;
E = 200000;
I = 250.9*10^.6;
L = 6;
deflection = @(x) (w0/(120*E*I*L)).*(-(x.^5) + 2*(L.^2)*(x^.3) - (L.^4)*x);
rotation = @(x) (w0/(120*E*I*L)).*(-5*(x.^4) + 6*(L.^2)*(x^.2) - (L.^4));
derivofrotation = @(x) (w0/(120*E*I*L)).*(-20*(x.^3) + 12*(L.^2)*(x));
plot(x, rotation(x))
This is my code. When I run wihhout the plot function it raises no errors. When the plot is there the following errors are raised:
Error using ^ (line 51)
Incorrect dimensions for raising a matrix to a power.
Check that the matrix is square and the power is a
scalar. To perform elementwise matrix powers, use '.^'.
Error in
MATLAB_MAJOR>@(x)(w0/(120*E*I*L)).*(-5*(x.^4)+6*(L.^2)*(x^.2)-(L.^4))
(line 8)
rotation = @(x) (w0/(120*E*I*L)).*(-5*(x.^4) +6*(L.^2)*(x^.2) - (L.^4));
Error in MATLAB_MAJOR (line 14)
plot(x, rotation(x))
Why are these errors coming up and what can I do to stop them?
Accepted Answer
More Answers (0)
Categories
Find more on Line Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!