Translate and rotate a curve

3 次查看(过去 30 天)
I have a curve as seen below:
I need to first find a new location of the curve, multiple it with two and then rotate it 180 degree, so it will end up looking similiar to the figure below (The darker curve is similiar to my curve above starting from 0,0)
First the curve should be doubled and placed at the end of the blue curve (existing curve), then mulitple the curve with two, so it will go trough the x-axis, and then rotate 180 degrees.
Can you maybe help me with this? The data is attached.

采纳的回答

Mathieu NOE
Mathieu NOE 2024-5-14
hello Mads
like this ?
load('pqfile.MAT')
% remove NaN and correct for size mismatch
A(isnan(A)) = [];
F(isnan(F)) = [];
A = A(3:end);
A(1) = 0; % force first value to 0
% central curve
x1 = [ -A(end:-1:2); A];
y1 = [ -F(end:-1:2); F ;];
% top curve
x_rev = -0.1;
y_rev = interp1(x1,y1,x_rev);
% let's do a strech of x data (linear equation xnew = a x + b)
% for the x data
a = 1 - x_rev/max(A);
b = x_rev;
Atop = a*A + b;
% for the y data
a = 1 - y_rev/max(F);
b = y_rev;
Ftop = a*F + b;
% the bottom curve is the symmetrical of the top curve
Abot = -Atop(end:-1:1);
Fbot = -Ftop(end:-1:1);
plot(x1,y1,'k','linewidth',3);
hold on
plot(Atop,Ftop,'r');
plot(Abot,Fbot,'b');
hold off

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Environment and Clutter 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by