How to write equation with exponential in matlab

조회 수: 6 (최근 30일)
Muthumari
Muthumari 2023년 4월 30일
댓글: Torsten 2023년 4월 30일
function s = newton_ls(y,d)
% initilaize lamba=0
s=0;
% let theta_d and theta_dd be the first and second dreivative of theta
while 1
theta_d = first_d(s);
theta_dd = second_d(s);
diff = - theta_d/theta_dd;
s= s+diff;
if abs(diff)<0.01
break;
end
end
function t_d = first_d(s)
t_d= 2*d(1,1)+(6*(d(2,1)^2*s))+(6*(d(2,1)*y(2,1))+((2*d(2,1))*((d(2,1)*s)+y(2,1)))+(4*d(1,1))*((d(1,1)*s)+y(1,1)))*exp(((d(2,1)*s)+y(2,1)^2)+((2*d(1,1)*s)+(y(1,1)))^2);
end
function t_dd = second_d(s)
t_dd=12*d(2,1)+2*d(2,1)^2+2*d(2,1)*d(2,1)*s+y(2,1)+4*d(1,1)*d(2,1)*s+y(1,1)^2*exp(d(2,1)*s+y(2,1)^2+2*d(1,1)*s+y(1,1)^2+2*d(2,1)^2+4*d(1,1)^2)*exp(d(2,1)*s+y(2,1)^2)+(2*d(1,1)*s+y(1,1)^2);
end
end
I got an error donno how to fix it
  댓글 수: 2
Walter Roberson
Walter Roberson 2023년 4월 30일
How are you invoking the function, and what error message are you getting?
Torsten
Torsten 2023년 4월 30일
How did you call "newton_ls" ? How did you choose y and d ?

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

답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by