Question in plotting same value for a range of values

7 views (last 30 days)
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!

Answers (0)

Categories

Find more on Graphics Objects in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!