Use the anonymous function function handle representation to call ‘Torque_Velocity_Function’ in your ode45 call:
[t,x] = ode45(@Torque_Velocity_Function, [0:t_step:40], h0, options);
Also, fitting the motor torque isn’t necessary. Interpolation will work, and it’s faster and more efficient:
Fitted_Motor_Torque_Curve = @(x) interp1(rotor_speeds, rotor_torques, x, 'pchip','extrap')
The documentation section on Anonymous Functions explains what they areand how to use them, if you’re not familiar with them. I use them here in the ode45 call, and to construct the ‘Fitted_Motor_Torque_Curve’ function.
Best Answer