필터 지우기
필터 지우기

Translate a plot across its axes

조회 수: 29 (최근 30일)
fsgeek
fsgeek 2012년 11월 30일
Hi guys,
I'm writing a program which draws the hysteresis loops on a stress/strain plot. In order to do this, I need to be able to move successive plots so that they begin where the last plot ends.
As you can see in the picture, I want to translate the steep-looking curve across the figure so that its head matches with the top of the shallower curve.
Thanks in advance,
Louis Vallance
  댓글 수: 1
Azzi Abdelmalek
Azzi Abdelmalek 2012년 11월 30일
Can you resize your image, it's too big.

댓글을 달려면 로그인하십시오.

채택된 답변

Image Analyst
Image Analyst 2012년 12월 1일
Try this demo:
% Make curve 1
x1 = 0:25;
y1 = x1 .^4;
% Make curve 2
x2 = 0:50;
y2 = 40000 * x2 .^ 0.3;
% Plot them
plot(x1, y1, 'r-', 'LineWidth', 2);
hold on;
grid on;
plot(x2, y2, 'g-', 'LineWidth', 2);
% Now make new, shifted curve
y3 = y1 - y1(end )+ y2(end);
x3 = x1 - x1(end) + x2(end);
% Plot the shifted curve.
plot(x3, y3, 'b-', 'LineWidth', 2);
legend('Curve 1', 'Curve 2', 'Shifted Curve 2');

추가 답변 (2개)

dpb
dpb 2012년 11월 30일
If values are (x,y1) and (x,y2) then
plot(x,y1,[x+x(end)-x(1)],[y2+y1(end)-y1(1)])
--

fsgeek
fsgeek 2012년 12월 5일
Thanks for the help guys, much appreciated.
Regards,
Louis Vallance

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by