필터 지우기
필터 지우기

how to plot three variables in a line graph with values ?

조회 수: 4 (최근 30일)
balajee J
balajee J 2013년 5월 14일
댓글: Waleed Eid 2022년 4월 17일
ax[1] = 0.98 ax[2] = 1.2 ax[3] = 0.23
bx[1] = 2.1 bx[2] = 0.236 bx[3] = 1.25
cx[1] = 0.01 cx[2] = 0.025 cx[3] = 0.52
plot(ax,bx,cx); is possible ?

채택된 답변

Jan
Jan 2013년 5월 14일
편집: Jan 2013년 5월 14일
ax = [0.98, 1.2, 0.23];
bx = [2.1, 0.236, 1.25];
cx = [0.01, 0.025, 0.52];
What do you expect now? Is ax the x-component of the line? Or should it be 1:3 implicitly?
x = 1:3;
plot(x, ax, x, bx, x, cx); % EDITED, Typo ay->ax
Or:
plot(x, [ax; bx; cx])

추가 답변 (1개)

Azzi Abdelmalek
Azzi Abdelmalek 2013년 5월 14일
편집: Azzi Abdelmalek 2013년 5월 14일
ax(1) = 0.98
ax(2) = 1.2
ax(3) = 0.23
bx(1) = 2.1
bx(2) = 0.236
bx(3) = 1.25
cx(1) = 0.01
cx(2) = 0.025
cx(3) = 0.52
plot(ax,bx,cx)
Use () instead of [ ]
  댓글 수: 2
Jan
Jan 2013년 5월 14일
편집: Jan 2013년 5월 14일
What do you expect as output, when you call plot() with three vectors?
I get this for your code:
??? Error using ==> plot
Data must be a single matrix Y or a list of pairs X,Y
Waleed Eid
Waleed Eid 2022년 4월 17일
you have incorrect code.
Error using plot
Data must be a single input of y --values or
one or more pairs of x -- and y--values.

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

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by