Not Enough Input Arguments? What Am I doing wrong??
1 view (last 30 days)
Show older comments
Jessica St.Julien
on 28 Apr 2014
Edited: Image Analyst
on 28 Apr 2014
hello,
I'm trying to program a function (omega).
the equation for my function is w=sqrt(36.75*sin(theta)-(390.625*(sqrt(.72*(1+sin(theta)))-sqrt(.72))^2))
I need to add the condition that when w=0, theta=theta_max. This is how I programmed the function but i keep getting error messages. What am I doing wrong?
function w = omega(theta)
w=sqrt(36.75*sin(theta)-(390.625*(sqrt(.72*(1+sin(theta)))-sqrt(.72))^2));
for theta=0:(90*pi)/180
if(w==0)
theta_max=theta_max+theta;
end
end
end
3 Comments
Walter Roberson
on 28 Apr 2014
What the heck are all those "magic numbers" ? why 36.75? why 0.72? why 390.625 ? Two of those look like degree values ?!
Accepted Answer
Image Analyst
on 28 Apr 2014
You never define theta_max, or passed it in. What is its value? And what is that for loop for? It looks like nonsense.
2 Comments
Image Analyst
on 28 Apr 2014
Edited: Image Analyst
on 28 Apr 2014
Maybe this???
function w = omega(theta)
w=sqrt(36.75*sin(theta)-(390.625*(sqrt(.72*(1+sin(theta)))-sqrt(.72))^2));
end
You're computing w, not inputting it, so you can't say that when w = 0, theta = theta_max. You're not even passing theta_max back out of the function! Maybe you want to answer a different question and that is "What is theta such that w = 0?"
More Answers (1)
Walter Roberson
on 28 Apr 2014
You cannot run the program by clicking on the Run button or pressing F5. You need to go down to the command line and type it in there, passing in an argument, such as
omega(1.32302)
See Also
Categories
Find more on Multirate Signal Processing 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!