Translate and rotate a curve

3 visualizzazioni (ultimi 30 giorni)
mads skibsted
mads skibsted il 14 Mag 2024
Risposto: Mathieu NOE il 14 Mag 2024
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.

Risposta accettata

Mathieu NOE
Mathieu NOE il 14 Mag 2024
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

Più risposte (0)

Categorie

Scopri di più su Environment and Clutter in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by