PDE toolbox: Undefined function 'mtimes' for input arguments of type 'function_handle'.
조회 수: 7 (최근 30일)
이전 댓글 표시
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
Dennis
2018년 10월 2일
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.
답변 (1개)
Stephen23
2018년 10월 2일
편집: Stephen23
2018년 10월 2일
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
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!