14 views (last 30 days)

Show older comments

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

Stephen Cobeldick
on 2 Oct 2018

Edited: Stephen Cobeldick
on 2 Oct 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

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!