Rotate & translate a plot

6 views (last 30 days)
Louis Vallance
Louis Vallance on 12 Dec 2012
Hi guys,
I'd like to rotate a curve by 180 degrees, then translate it across the figure to match up with another curve, as follows:
In order to rotate the curve, I use the following code:
%Plot the blue curve
h1=plot(trueStrainRange,trueStressRange,'b-','LineWidth',3);
%Rotate the curve by 180 degrees
rotate(h1,[0 0 1],180);
The result is illustrated by the second picture. I then want to move the blue curve so that its left-side fits with the left side of the green curve. In order to achieve this, I tried the following code:
%Create a new set of x/y coordinates for the translated curve
y3=trueStressRange-trueStressRange(1)+trueStressRangeFlip(1);
x3=trueStrainRange-trueStrainRange(1)+trueStrainRangeFlip(1);
h1=plot(x3,y3,'b-','LineWidth',3);
%true[Strain/Stress]Range are the original [x/y] coords of the blue curve
%true[Strain/Stress]RangeFlip are the [x/y] coords of the green curve
%x3/y3 are the new x/y coordinates for the blue curve
However, this produces the following result:
It seems that the code I used above used the old data points from the blue curve before it was rotated, causing the original, un-rotated blue curve to overlap the green curve. I want to be able to use the data points from the newly-rotated curve. Are the data points from a rotated plot available so that I can correctly translate the curve?
Cheers,
Louis Vallance

Answers (0)

Community Treasure Hunt

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

Start Hunting!