sir, i am not able develop a matlab code to solve four transcendental equations using newton raphson method? i had tried till the creation of jacobian matrix but not able to substitute values in the jacobian matrix please help to solve this problem?
1 回表示 (過去 30 日間)
古いコメントを表示
omkari sai krishna
2020 年 4 月 19 日
編集済み: Devineni Aslesha
2020 年 5 月 4 日
syms x1 x2 x3 x4 epsi;
g1=cos(x1)+cos(x2)+cos(x3)+cos(x4)-0.9424;
g2=cos(5*x1)+cos(5*x2)+cos(5*x3)+cos(5*x4);
g3=cos(7*x1)+cos(7*x2)+cos(7*x3)+cos(7*x4);
g4=cos(11*x1)+cos(11*x2)+cos(11*x3)+cos(11*x4);
g=[g1;g2;g3;g4];
x=[x1; x2; x3; x4];
epsi=10e-5;
j=jacobian(g,x);
for i=1:4
x(i,1)=input('enter the intial values\n')
end
disp(x)
f=subs(j);
j_inv=inv(f);
disp(-g);
k=subs(-g);
p=j_inv*k;
This is my code i am not able to substitute initial values in 'P' matrix. please help me to solve this.
0 件のコメント
採用された回答
Devineni Aslesha
2020 年 4 月 24 日
In the given code, the values are not substituted in the jacobian matrix because the initial values are assigned to the variable 'x' but the variables used in the equations are 'x1,x2,x3 and x4'. Please find the code below to substitute the initial values.
x1 = x(1,1);
x2 = x(2,1);
x3 = x(3,1);
x4 = x(4,1);
For more information, refer to this file exchange link
5 件のコメント
Devineni Aslesha
2020 年 5 月 4 日
編集済み: Devineni Aslesha
2020 年 5 月 4 日
In the above code, you are computing the answer 'xyzvans' even if there is no solution available. Use the return command after display('no solution'); to stop running this script when there is no solution. In this way, the answer will be computed only when the error value is less than epsilon.
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!