PDE toolbox: Undefined function 'mtimes' for input arguments of type 'function_handle'.
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
Respuestas (1)
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
Stephen23
el 2 de Oct. de 2018
"My problem is that I don't really have an idea of what happens in effStress, as I am using the PDE toolbox"
It is not clear what you mean: a function handle is a function handle, regardless of what toolboxes you might have installed. You can evaluate them, pass them as variables, or use them to define other function handles. What do you want to do with your function handle?
"I'd just like to get the state of my function u through this function handle"
Then you might want to evaluate the function handle to get an output. But it is not clear, because the "state" of your function is a property of your data, not a property of any function handle (i.e. the state is determined by some meaning you attribute to some data. How this "state" relates to any function handle depends on your algorithm and how you have written your code... not things that I know).
Ravi Kumar
el 2 de Oct. de 2018
Can you provide the context of usage with a complete example?? Which function of PDE Toolbox are you referring to? Is your question, what is the value of state.u that solver passes when solve a model?
Flo brd
el 3 de Oct. de 2018
Categorías
Más información sobre Structural Mechanics 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!