Question in plotting same value for a range of values

조회 수: 1 (최근 30일)
Amit Kumar
Amit Kumar 2013년 10월 30일
Hi all, I am trying very hard to plot same values for a number of values, but no success. I request to you to help me. Here is my code:
stra= [ 0.9375, 0.8125, 0.6875, 0.5625, 0.4375, 0.3125, 0.1875, 0.0625];
for i=1:1:8
for j=i:1e-2:(i+1)
t1(j)= stra(i);
t2(j)=j;
plot(t2,t1,'r');
hold on;
end
end
stra is 1x8 array. Basically I want to plot value 0.9375 i.e. stra(1) for x=1 to 2 (x is values along x axix, stra is values along y axis). So, I am dividing x=1 to 2 (i=1 to 2) into 100 parts and assigning stra(1) to all, then plotting x and y with hold command. But I am not getting desired output. Also I understand that when i=8, there would be problem in j. However, I could not think another way. Can you tell me how I can do this task? Thanks in advance!

답변 (0개)

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by