How to use symsum to calcolate residuals

조회 수: 1 (최근 30일)
laura bagnale
laura bagnale 2021년 8월 25일
답변: Walter Roberson 2021년 8월 26일
Hello everyone!
Could someone help me, please?
I have these vectors:
x = [0; 0; 0; 0; 1]
y = [1; 0.15; 0.03; 0; 0.89]
z=[0; 0.35; 0.70; 1; 0.86]
I would like to calculate this redisuals' expression:
Rtot = sumRi , Ri = (zi - a*xi - b*yi - c*xi*yi - d).^2
for each index i. For example for i = 4 I would have:
Ri = (0.86 - a*1 - b*0.89 - c*1*0.89 - d).^2.
Is there a way to perform this sum?
Thank you very much in advance for your suggestions and help.
Regards
Laura
  댓글 수: 5
laura bagnale
laura bagnale 2021년 8월 26일
Thank you very much to both of you for your help.
I tried and it works!
Regards
Laura
laura bagnale
laura bagnale 2021년 8월 26일
How Can I accept your cooment/answer?
Thanks a lot

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

채택된 답변

Walter Roberson
Walter Roberson 2021년 8월 26일
Bringing down from above,
R = (z - a*x - b*y - c*x.*y - d).^2;
Rtot = sum(R);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

태그

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by