PDE toolbox: Undefined function 'mtimes' for input arguments of type 'function_handle'.
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi everyone,
I have a bit of a hard time finding a way to use the output of my function handle:
effStress = @(~,state) (2700*9.81*4000*1e-6)-state.u;
K = 1e-12-(0.04343*((0.012+0.013)/2));
Dcore=(K*effStress);
I understand that I apparently cannot multiply K with effStress, but even a matrix multiplication doesnt work.
Could anyone help me on that?
Cheers, Flo
2 comentarios
Dennis
el 2 de Oct. de 2018
You probably need to provide an input to effStress. Small example:
eff=@(a) a+1; %eff is a function handle
%A=3*eff; %this does not work
A=3*eff(3) %this does.
Respuestas (1)
Stephen23
el 2 de Oct. de 2018
Editada: Stephen23
el 2 de Oct. de 2018
1. evaluate the function to get a numeric value, and multiply that value:
>> S.u = 4;
>> effStress = @(~,state) (2700*9.81*4000*1e-6)-state.u;
>> K = 1e-12-(0.04343*((0.012+0.013)/2));
>> K*effStress(0,S) % evaluate effStress to get an output.
ans = -0.055345
2. define a new function that calls your function:
>> fun = @(s)K*effStress(0,s); % does not evaluate effStress.
>> fun(S)
ans = -0.055345
5 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!