I want to plot the mirror image of a cubic curve.
In other words, I intend to flip the plot, but I do not want the x- axis to change.
This is my code and the plot. Thank you
clear all;close all;clc;
x=linspace(0, 100);
y=x.^3;
plot(x,y,'LineWidth', 2);set(gca,'xdir','reverse')

 採用された回答

Walter Roberson
Walter Roberson 2022 年 9 月 4 日

0 投票

clear all;close all;clc;
x=linspace(0, 100);
y=x.^3;
plot(x,fliplr(y),'LineWidth', 2);set(gca,'xdir','reverse')

5 件のコメント

Grace
Grace 2022 年 9 月 4 日
Hi, Roberson.
Thank you your response. I have flipped my plot already. However it is ONLY the x axis I dont want to alter. I want the x-axis to begin from 0.
Walter Roberson
Walter Roberson 2022 年 9 月 4 日
I do not know which of these you are looking for
x=linspace(0, 100);
y=x.^3;
plot(x,y,'LineWidth',2); title('original');
plot(x,y,'LineWidth',2); set(gca,'XDir','reverse'); title('reverse xdir')
plot(x,fliplr(y),'LineWidth',2); title('fliplr y');
plot(x,fliplr(y),'LineWidth',2); set(gca,'XDir','reverse'); title('fliplr y + reverse xdir')
Grace
Grace 2022 年 9 月 4 日
Great! Thank you. It is the second plot I need.
Walter Roberson
Walter Roberson 2022 年 9 月 4 日
... but that is the one you started with ??
Grace
Grace 2022 年 9 月 4 日
I meant the seond plot (without counting the 'original plot')

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

質問済み:

2022 年 9 月 4 日

コメント済み:

2022 年 9 月 4 日

Community Treasure Hunt

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

Start Hunting!

Translated by