필터 지우기
필터 지우기

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