fplot command makes plot white

2 visualizaciones (últimos 30 días)
Dimitrios Adam
Dimitrios Adam el 11 de Nov. de 2019
Editada: Walter Roberson el 11 de Nov. de 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

Respuesta aceptada

Steven Lord
Steven Lord el 11 de Nov. de 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.)

Más respuestas (0)

Categorías

Más información sobre Data Type Conversion en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by