필터 지우기
필터 지우기

Draw a curve in matlab figure

조회 수: 20 (최근 30일)
Rudolf
Rudolf 2021년 4월 26일
댓글: Rudolf 2021년 4월 27일
I need to draw a curve for illustration purposes in a figure together with some other more specific values. I'm looking for something like this:
I need it to be smooth like that one, and have the ability to adjust it. How could i do that?
  댓글 수: 2
DGM
DGM 2021년 4월 26일
편집: DGM 2021년 4월 26일
If you have a few waypoints, you might just be able to do something like this:
x = [0 1 2 2.5 3 4 5 6 6.2 7 8];
y = [0 0.5 1 0.95 0.65 0.25 0.8 1.3 1.3 0.7 0.1];
xf = linspace(0,8,100);
yf = interp1(x,y,xf,'spline');
plot(xf,yf)
axis equal
There are also ROI drawing tools (drawfreehand, imfreehand), but I don't know how you'd easily go about making such an object into an open curve. Depending on how it needed to be integrated into the figure content, I'd probably just export the figure and add the curve in an image editor that can do practical bezier curves interactively.
Rudolf
Rudolf 2021년 4월 27일
Thank you, your code is a good way to do it, and makes it easy to adjust the curve. I guess the code is the fastest way to a satisfying result.

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

채택된 답변

Jan
Jan 2021년 4월 26일
figure;
x = linspace(0, 2*pi, 1000);
y = sin(x).^2 + sin(x / 2).^2 .* x / 10;
plot(x, y)
  댓글 수: 1
Rudolf
Rudolf 2021년 4월 27일
Thank you, this is definately a way to do it if good at math.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Interpolation에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by