フィルターのクリア

Centering different yaxis plots at the same point

2 ビュー (過去 30 日間)
BobbyRoberts
BobbyRoberts 2020 年 5 月 18 日
回答済み: Star Strider 2020 年 5 月 18 日
Hi. I am trying to plot arrays of which have different y ranges. For example, array1 could range from -1 to 1 while another may range from 1 to 3. An example of the code is as follows:
for j = 1:30
plot(array(1:shut(j),j));
end
As you see, each array (j) begins at a different y value. Is there a way I can have all of these arrays begin at the same y value graphically without altering the arrays themselves? The actual value of the y would not matter so long as the relative ranges are the same. Thanks in advance!

採用された回答

Star Strider
Star Strider 2020 年 5 月 18 日
Subtract the first y-value from each one and they all should begin at 0.
Example —
x = sort(rand(5, 20),2);
y = randi(20, 5, 20);
figure
hold on
for k = 1:size(x,1)
plot(x(k,:), y(k,:))
end
grid
figure
hold on
for k = 1:size(x,1)
plot(x(k,:), y(k,:)-y(k,1))
end
grid
.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLine Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by