Asked by Ben
on 4 May 2013

I'm attempting to make a simple m file which plots solutions to a force problem given a range of theta and generates the resulting mass (m) required for equilibrium. So far, my code doesn't account for solving for m, but I'm just trying to generate an answer right now and I get the "Not enough input arguments" error. Then when I tried in the command window "F_theta(0)" I get "Undefined function 'F_theta' for input arguments of type 'double'." Any help would be appreciated, thanks.

function F_theta=Matlab_assignment_3(theta)

WPanel=[0, 20*9.8, 0]; That=[(.2-.2*sind(theta)),(.1+.2*cosd(theta)),-.125]/(sqrt((.2-.2*sind(theta))^2+(.1+.2*cosd(theta))^2+(-.125)^2)); Tmag=9.8*m; T=That*Tmag; rgb=[.1*sind(theta),-.1*cosd(theta),.125]; rcb=[.2*sind(theta),-.2*cosd(theta),.125]; rab=[0,0,.25]; MW=cross(rgb,WPanel); MT=cross(rcb,T); MAx=cross(rab,[1,0,0]); MAy=cross(rab,[0,1,0]); MB=[MAx' MAy' MT' MW']; A_MB=rref(MB); F_theta=A_MB(0,90);

Edit: Okay, so I think I'm approaching the variable situation all wrong, so I have two variables, m and theta, and my hopes is to have an equation that solves for m in terms of theta (for a range of theta that I can then plot). Should I be using system variables instead?

*No products are associated with this question.*

Answer by Azzi Abdelmalek
on 4 May 2013

Edited by Azzi Abdelmalek
on 4 May 2013

You should use

Matlab_assignment_3(0)

Your function is called Matlab_assignment_3

Answer by Image Analyst
on 4 May 2013

You need to call Matlab_assignment_3 first, with some input arguments before you can do "F_theta(0)" in the command window. Actually that wouldn't even work because F_theta is not a function, it's an array so the first element is 1, not 0. You could try

% Define some input angle. theta = 45; % Call the function and get F_theta in return. F_theta=Matlab_assignment_3(theta) % Display first element in command window. F_theta(1)

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi test

Learn moreOpportunities for recent engineering grads.

Apply Today
## 0 Comments