define function to data set

조회 수: 1 (최근 30일)
ignacio bobadilla tapia
ignacio bobadilla tapia 2021년 6월 22일
댓글: ignacio bobadilla tapia 2021년 6월 22일
Hello, please if you could help me to fit a function to a data series, I understand that the 'fit' function of matlab works excellent, but it does not give me good results. What I have to do is fit the best possible function to a figure that has the semi-logarithmic vertical scale. I attach the data and the respective figure. Thanks greetings.
load x.txt
load y.txt
semilogy(x,y,'ob')

답변 (1개)

KSSV
KSSV 2021년 6월 22일
x = importdata('x.txt') ;
y = importdata('y.txt') ;
y = log(y) ;
p = polyfit(x,y,2) ;
yi = polyval(p,x) ;
plot(x,y,'.r',x,yi,'.b')
  댓글 수: 1
ignacio bobadilla tapia
ignacio bobadilla tapia 2021년 6월 22일
How can I make the equation display on the graph?

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by