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 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
omkari sai krishna
il 19 Apr 2020
Modificato: Devineni Aslesha
il 4 Mag 2020
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 Commenti
Risposta accettata
Devineni Aslesha
il 24 Apr 2020
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 Commenti
Devineni Aslesha
il 4 Mag 2020
Modificato: Devineni Aslesha
il 4 Mag 2020
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.
Più risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!