fplot command makes plot white
1 view (last 30 days)
Show older comments
Dimitrios Adam
on 11 Nov 2019
Edited: Walter Roberson
on 11 Nov 2019
Hello ,
I have for example a function like M1z = @(x) F1*x - I1*(x-l1/2) ; and Ixx = @(x) (bx+c)^4/64 ; and i write
Sxx =@(x) M1z*(bx+c)/2/Ixx ; and then i type
fplot(SXX1,[0 1.5],'b')
hold on
fplot(SXX2,[1.5 3],'b')
hold off
grid on
but the plot is only white how can i fix this; I dont want the option to make x and array and then plot it
0 Comments
Accepted Answer
Steven Lord
on 11 Nov 2019
Those ought to throw an error. You can't multiply a function handle and a number. You can multiple the result you receive from evaluating a function handle and a number, however.
% Arbitrary values for the variables used in the anonymous functions
F1 = 2;
I1 = 3;
l1 = 4;
b = 5;
c = 6;
M1z = @(x) F1*x - I1*(x-l1/2);
% I assume bx should be b*x otherwise Ixx doesn't depend on x
Ixx = @(x) (b*x+c)^4/64;
% Evaluate M1z and Ixx at x and use the results in evaluating Sxx at x
Sxx =@(x) M1z(x)*(b*x+c)/2/Ixx(x);
fplot(Sxx,[0 1.5],'b')
This issues a warning. You probably want to vectorize Sxx and Ixx using element-wise multiplication, division, and power (the .*, ./, and .^ operators instead of the *, /, and ^ operators.)
0 Comments
More Answers (0)
See Also
Categories
Find more on Data Type Conversion 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!