How to change LineWidth and MarkerSize in plot fit curve ?

조회 수: 136 (최근 30일)
Ivan Mich
Ivan Mich 2021년 3월 3일
댓글: KALYAN ACHARJYA 2021년 3월 3일
I am using this code in order to plot my data.
The problem is that I can not change the size and the linewidth of my plot.
I used this
filename='final.txt'
d1= importdata(filename);
x=d1.data(:,1)
y=d1.data(:,2)
f=fit(x,y,'poly1')
plot(f,'r--',x,y,'b^','MarkerSize',10);
But no use. The problem is in command
plot(f,'r--',x,y,'b^','MarkerSize',10);
Command window shows
Error in test_trendline (line 17)
plot(f,'r--',Distance,IMM,'b^','MarkerSize',10);
Could you please help me?

채택된 답변

KALYAN ACHARJYA
KALYAN ACHARJYA 2021년 3월 3일
편집: KALYAN ACHARJYA 2021년 3월 3일
Can you try this way?
figure,plot(f,'r--');
hold on;
plot(x,y,'^b','MarkerSize',10);
May be because of different class, here 'f' is cfit class
  댓글 수: 2
Ivan Mich
Ivan Mich 2021년 3월 3일
What about the linewidth? This code you give me grows only the markersize. What about the fit curve?
KALYAN ACHARJYA
KALYAN ACHARJYA 2021년 3월 3일
Set the linewidth as you want
fig=plot(f,'r--');
set(fig,'lineWidth',2);
%.................. ^
hold on;
plot(x,y,'^b','MarkerSize',10);

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by