Translate and rotate a curve
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
mads skibsted
am 14 Mai 2024
Beantwortet: Mathieu NOE
am 14 Mai 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.
0 Kommentare
Akzeptierte Antwort
Mathieu NOE
am 14 Mai 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
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Environment and Clutter finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!