fplot command makes plot white
조회 수: 2 (최근 30일)
이전 댓글 표시
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
채택된 답변
Steven Lord
2019년 11월 11일
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Type Conversion에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!