help: I need to solve the problem of the function "lsqcurvefit" I have an error when I started to run the program

조회 수: 2 (최근 30일)
Hello,
I have an error in the function "lsqcurvefit" that I have to use, I tried to solve the problem but I don't know what the error is exactly, I have to know that I respect the syntax of the function.?
Thank you for your help
  댓글 수: 4
Torsten
Torsten 2023년 3월 21일
Neither the array "xdata" nor the array "ydata" appear in the definition of your function "fun". That's why you have only a single equation for the unknown vector x. I doubt this is what you want.
Sou Fat
Sou Fat 2023년 3월 21일
xdata appear in the function like the time (beacuse i wrote in the top of the programme the xdata=Duree) but ydata i declareted also but i can't use in the function .
my function is : T(t)=A+b.*(C1-C1) which C1 et C2 depend the time.
I need to find the values of x to fit the "fun" function to the ydata.?
so i don't know exactely the probleme ?

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

답변 (1개)

Cris LaPierre
Cris LaPierre 2023년 3월 21일
편집: Cris LaPierre 2023년 3월 21일
The error message mentions 'dot indexing', which means you have likely forgotten a multiplication symbol in your equation. I found this about halfway through your equation: Kth.x(2)
You probably meant to do elementwise multiplication: Kth.*x(2)
  댓글 수: 5
Cris LaPierre
Cris LaPierre 2023년 3월 22일
I linked to the corresponding page in the documentation.
You could also just attach your excel file using the paperclip icon, but you also need to then share the code that loads that spreadsheet as well as the code that creates the variables used when calling lsqcurvefit.
Sou Fat
Sou Fat 2023년 3월 25일
Thank you for your answer, I found how savibg the variables to à mat file.

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

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by