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

1 次查看(过去 30 天)
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 个评论
Star Strider
Star Strider 2014-9-29
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 )?

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Structures 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by