How do I make a function with 2 parameters?

2 views (last 30 days)
Mattias Hertzberg
Mattias Hertzberg on 18 Nov 2020
Commented: Rik on 18 Nov 2020
I tried this which apparently worked previously but when i try it it doesnt work
>>function y=kastbana(x, theta)
>>t=theta*pi/180; % theta i grader, t i radianer
>>v0=10; y0=1.85; g=9.81;
>>a=g/(2*v0^2*cos(t)^2); b=v0^2*sin(2*t)/(2*g); c=v0^2*sin(t)^2/(2*g);
">> kastbana(x,theta)
Unrecognized function or variable 'theta'."
Mattias Hertzberg
Mattias Hertzberg on 18 Nov 2020
Thanks! I didn't know about that, but I'm just wondering if theres a small mistake I've done here.

Sign in to comment.

Answers (1)

madhan ravi
madhan ravi on 18 Nov 2020
Man muss einfach versuchen.
doc function
Rik on 18 Nov 2020
The doc command searches the documentation. So running doc function in your command window will open the documentation page for the function keyword. That will contain an explanation about how to use it, and some examples and links.

Sign in to comment.


Community Treasure Hunt

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

Start Hunting!