Non numeric data X plot

조회 수: 7 (최근 30일)
Tiago Araujo
Tiago Araujo 2021년 4월 17일
댓글: Tiago Araujo 2021년 4월 19일
I need help to solve this plot:
syms X L
X = 0:L/16:L;
Y = 1 + 2*X;
plot (X,Y);
This is just an example, the function I am trying to solve is a bit complicated.

채택된 답변

Walter Roberson
Walter Roberson 2021년 4월 17일
In this particular case, you can plot something meaningful. In most cases, you cannot plot with unresolved symbolic variables unless you use fplot() or fplot3() or fsurf() to have MATLAB automatically substitute specific numeric values for the unresolved values.
You cannot, for example, plot a family of curves expecting it to show you abstract curves such as "s", "s/2", "s/4", "3s/2" and so on. Plotting always requires that something replaces all symbolic variables with particular numeric values.
syms X L
X = 0:L/16:L;
Y = 1 + 2*X;
fplot3(L, X, Y, [0 20]); xlabel('L'); ylabel('X'); zlabel('Y');
  댓글 수: 5
Walter Roberson
Walter Roberson 2021년 4월 18일
편집: Walter Roberson 2021년 4월 18일
syms X L
X = 0:L/16:L;
for i=1:length(X)
Y(i) = 1 + 2*(X(i)/L);
end
figure
plot(X/L, Y);
xticklabels(string(sym(xticks)) + " L")
Tiago Araujo
Tiago Araujo 2021년 4월 19일
Great man, you are great!!!
THANKS!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Number Theory에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by