function doesn't take number from main function
Mostrar comentarios más antiguos
error: ??? Error using ==> sym.sym>notimplemented at 2621 Function 'lt' is not implemented for MuPAD symbolic objects.
Error in ==> sym.sym>sym.lt at 812 notimplemented('lt');
Error in ==> solverNRlinear at 19 if lt(norm_funkcije,tol)
Error in ==> glavnapokusaj at 79 [Sol]=solverNRlinear(initSol, epsp_novo1(i-1), epsp_novo2(i-1), epsp_novo12(i-1), alpha(i-1), epstotal1(i), epstotal2(i), epstotal12(i), K, lam, mi, sigmay);
I know that error stands for sym variable in solver NRlinear function, but in main function a set number for that syms:
else
initSol=[sigma_kon1(i-1) sigma_kon2(i-1) sigma_kon12(i-1) epsp_novo1(i-1) epsp_novo2(i-1) epsp_novo12(i-1) alpha(i-1) 0]
[Sol]=solverNRlinear(initSol, epsp_novo1(i-1), epsp_novo2(i-1), epsp_novo12(i-1), alpha(i-1), epstotal1(i), epstotal2(i), epstotal12(i), K, lam, mi, sigmay);
solverNR linear: function[Sol]=solverNRlinear(initSol, epspn1, epspn2, epspn12, alfan, eps1, eps2, epsp_novo12, K, lam, mi, sigmay)
Maxiter=100; tol=10e-6;
for iter=0:Maxiter
[fjacobian,InvJac]=linearfun(initSol, epspn1, epspn2, epspn12, alfan, eps1, eps2, epsp_novo12, K, lam, mi, sigmay);
delX=-InvJac*fjacobian
X=initSol+delX'
In linearfun I set (because of derivation):
syms sigma1 sigma2 sigma12 devsigma1 devsigma2 devsigma12 eps1 eps2 eps12 epsp1 epsp2 epsp12 epspn1 epspn2 epspn12 lambda alfa alfan
So solverNRlinear function only works with sym and don't want to use values from main function.
4 comentarios
Stephen23
el 17 de Abr. de 2018
Ivan Labetic
el 17 de Abr. de 2018
Editada: dpb
el 17 de Abr. de 2018
Walter Roberson
el 17 de Abr. de 2018
Please show the complete code for the function that is failing.
Respuestas (1)
Walter Roberson
el 17 de Abr. de 2018
function [f]=fun2(z, x, y) z1=z(1) z2=z(2) syms x y z1 z2 f=x^2+y+z1+z2 end
Your call to syms is the same as if you had done
x = sym('x') ;
y = sym('y') ;
z1 = sym('z1') ;
z2 = sym('z2') ;
And like all other assignments this overwrites the previous value of the variables. You are replacing all of your inputs with sym variables, discarding any numeric inputs.
Categorías
Más información sobre Common Operations en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!