Question in plotting same value for a range of values

1 次查看(过去 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