Hi everyone,
I'm trying to minimiza and area. In my problem I have an exerimental curve and a polynomial and i want to minimiza the area between the two.
I have tried with this code but it does not work very well:
%%%%%%%%%%%%%%%%
x=( Cp5_diff(m(1):c(1))-polyval(z,T10(m(1):c(1))) );
Area2=@(z) sum( ( x.*dt(m(1):c(1)) ) );
best_z=fminsearch(Area2,z);
%%%%%%%%%%%%%%%%
Do you have any suggestion?
Thank you!

 채택된 답변

Matt J
Matt J 2020년 11월 25일
편집: Matt J 2020년 11월 25일

0 개 추천

Your objective function Area2 is written to be a function of z, but nothing in
sum( ( x.*dt(m(1):c(1)) ) )
depnds on z. Perhaps this is what you intended,
x= @(z) ( Cp5_diff(m(1):c(1))-polyval(z,T10(m(1):c(1))) );
Area2=@(z) sum( ( x(z).*dt(m(1):c(1)) ) );

댓글 수: 2

Daniele Sonaglioni
Daniele Sonaglioni 2020년 11월 25일
Thank you very much! Your suggestion was right and now my code works!
Matt J
Matt J 2020년 11월 25일
I'm very glad, but please Accept-click the answer to indicate that it resolved the problem.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 MATLAB에 대해 자세히 알아보기

질문:

2020년 11월 25일

댓글:

2020년 11월 25일

Community Treasure Hunt

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

Start Hunting!

Translated by