フィルターのクリア

Plotting two plots with 2 different y axes

1 回表示 (過去 30 日間)
KKR
KKR 2012 年 4 月 7 日
Hi Everyone,
Hope everyone is doing great and having a great easter break.
I have minor issue regarding plotting two plots with two y-axes. I tried plotyy but i didnt work as I kept getting error message that vectors should be of same length.
spot_y = (3000:500:13000)';
delta_y = (-1:0.1:1)';
plotyy(spot(:,1),spot_y,portdelta(:,1),delta_y)
spot(:,1) and portdelta(:,1) are what I would like to plot and their length is 108. I am not sure what am I doing wrong.
Can anyone please help? Thank you in advance.

回答 (1 件)

Walter Roberson
Walter Roberson 2012 年 4 月 7 日
Well, length(spot_y) isn't 108, and neither is length(delta_y).
It would be unusual to be plotting data with variable x coordinates but with regularly spaced y coordinates.
I wonder if you meant
plotyy(spot(:,1),portdelta(:,1), spot_y, delta_y)
Or maybe you want
spot_y = linspace(3000, 13000, size(spot,1)) .';
delta_y = linspace(-1, 1, size(delta_y,1)) .';
plotyy(spot(:,1),spot_y,portdelta(:,1),delta_y)

カテゴリ

Help Center および File ExchangeTwo y-axis についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by