Hi Hamish,
I understand that you want to integrate multiple variables mentioned in your Simulink model into MATLAB code. You can use ‘integral3’ function to numerically evaluate triple integral. For example:-
%Define the anonymous function f(x,y,z)=ysinx+zcosx.
fun = @(x,y,z) y.*sin(x)+z.*cos(x)
% Integrate over the region 0≤x≤π, 0≤y≤1, and −1≤z≤1.
q = integral3(fun,0,pi,0,1,-1,1)
Reference link
- https://in.mathworks.com/help/symbolic/index.html?s_tid=CRUX_lftnav ( Documentation for using Symbolic Variables)
- https://www.mathworks.com/help/matlab/ref/integral3.html (Documentation on using the ‘integral3’ function)
- https://in.mathworks.com/help/symbolic/integration.html (Documentation on using integration on single variable)