フィルターのクリア

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 Center および File ExchangeStructures についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by