find the values of polynomial to use polyfit

조회 수: 2 (최근 30일)
Zeynep Toprak
Zeynep Toprak 2020년 3월 26일
댓글: Zeynep Toprak 2020년 3월 28일
By using the census population data, Show that the relationship results between t and the log of the population by setting . To find and , you use the code of polyfit,
where this data is fitted in the form of
So, let's define population as p
Since ,
And log of p is
load census
t = (cdate - 1790)/10;
lnp = @(c) log(c(2)) + c(3)*t;
polyfit( lnp, t)
I write this code to find c(2) and c(3). But this code does not work. I get error.

채택된 답변

Cris LaPierre
Cris LaPierre 2020년 3월 26일
With polyfit, you supply it the X and Y data and it returns the equation for you. Well, the coefficients of the polynomial of the order you specify. The error message you are getting is becaue you are trying to pass in an anonymous function for X.
  댓글 수: 28
Zeynep Toprak
Zeynep Toprak 2020년 3월 27일
wow, perfect thank you so much for your great effort!! You're the best! Take care! :)
Zeynep Toprak
Zeynep Toprak 2020년 3월 28일
Hello professor again, yesterday, you explained this question perfectly. these are not assigments. since classes are closed down, on these leisure times, I try to improve my matlab skills by myself by following videos on youtube and solving some exercises. i have one more question. i solved it mostly. but at the end i need to solve two nonlinear equation simutanously. bu i could not here. Or can i do question with fminsearch ? My question is here if you 're going to help me one more, i will be glad. :)

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Solver Outputs and Iterative Display에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by