I'm trying to calculate the zero of a function, and keep getting "Function 'subsindex' not defined for values of class 'struct'" error?

1 view (last 30 days)
I'm trying to calculate the zero of the function F_net and assign it to the variable omega_zero(ii) in the following program:
slope_list_deg=linspace(-10,35,25);
rover=struct('wheelm',1,'motorm',5,'sciencepayloadm',75,'rtgm',90,'chassism',659,'speedreducerm',1.5,'wheel_radius',.3);
planet=struct('acceleration_grav',3.72);
for ii = 1:length(slope_list_deg)
omega_zero(ii) = fzero(@(omega_z) F_net(omega_z,slope_list_deg(ii),rover,planet,Crr),1);
end
However, I keep getting the following error:
Error using fzero (line 289)
FZERO cannot continue because user supplied function_handle ==> @(omega_z)F_net(omega_z,slope_list_deg(ii),rover,planet,Crr) failed with the error
below.
Function 'subsindex' is not defined for values of class 'struct'.
Error in analysis_terrain_slope (line 7)
omega_zero(ii) = fzero(@(omega_z) F_net(omega_z,slope_list_deg(ii),rover,planet,Crr),1);
I can't figure out where the problem is can anyone help?
  1 Comment
Star Strider
Star Strider on 29 Sep 2014
It would help to know what ‘F_net’ is and what it does. (If it’s a huge function file, attach it using the ‘paperclip’ or ‘staple’ icon instead of posting it in a Comment.)
Is there any particular reason you’re using structures ( e.g. instead of cells )?

Sign in to comment.

Answers (0)

Categories

Find more on Structures in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!