필터 지우기
필터 지우기

Plotting graph using M-file.

조회 수: 18 (최근 30일)
Shantanu K
Shantanu K 2013년 3월 1일
I want to plot graph of x Vs y. So when i do below steps its showing me error as Too many input arguments. So please let me know if you have any idea about this.
for i = 1:10:100
y=i+2;
t=y^2+4;
x(i) = (2*t-1);
k(i)=y+1;
end
plot (x(i),y(i))
I
  댓글 수: 4
kash
kash 2013년 3월 1일
the reason i sthe value x has more values than y ,y has single value,use plot inside loop
Shantanu K
Shantanu K 2013년 3월 1일
i tried by using plot inside loop command still its showing error.

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

채택된 답변

kash
kash 2013년 3월 1일
편집: kash 2013년 3월 1일
Try this
for i = 1:10:100
y=i+2;
t=y^2+4;
x(i) = (2*t-1);
k(i)=y+1;
bar(x,y)
end
  댓글 수: 1
Shantanu K
Shantanu K 2013년 3월 1일
편집: Shantanu K 2013년 3월 1일
Thanks Kash for your answer but i want it in x Vs y format only....so if you know any other way please let me know. I am doing this program in m-file so i want this to work in mfile

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

추가 답변 (1개)

ChristianW
ChristianW 2013년 3월 1일
k = 0;
for m = 1:10:100
k = k+1;
y(k)=m+2;
t=y(k)^2+4;
x(k) = (2*t-1);
end
plot(x,y)
  댓글 수: 3
ChristianW
ChristianW 2013년 3월 1일
Copy/Paste it to a new m-file, save and run it.
kash
kash 2013년 3월 1일
It works fine in my system,datas are plotted

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

카테고리

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