Translate and rotate a curve

3 ビュー (過去 30 日間)
mads skibsted
mads skibsted 2024 年 5 月 14 日
回答済み: Mathieu NOE 2024 年 5 月 14 日
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 Center および File ExchangeEnvironment and Clutter についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by