Forums: » Register « |  Free Tools |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |

New Free Tools on Dev Shed!

#1
September 25th, 2013, 01:07 PM
 Chemchick
Registered User

Join Date: Sep 2013
Posts: 1
Time spent in forums: 46 m 33 sec
Reputation Power: 0
Homework - Matlab. Undefined function 'Games' for input arguments of type 'double'.

So I'm supposed to describe a function and I'm getting it all wrong. Can anyone see the problem?

function file.

function y=Games(x,theta) t=theta*pi/180; 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);

y=y0-a*(x-b).^2+c;

Script file

x=linspace(0,14);

plot([0 14],[0 0],'green'), hold on

plot(x,Games(x,15)), text(6.4,1.6,'15^o')

plot(x,Games(x,30)), text(6.4,3.2,'30^o')

plot(x,Games(x,45)), text(6.4,4.6,'45^o'), hold off

title('games with v_0=10 m/s and diff \theta')

xlabel('x'), ylabel('y(x)')

axis equal, axis([0 14 -2 6])

#2
September 25th, 2013, 06:28 PM
 MrFujin
Lord of the Dance

Join Date: Oct 2003
Posts: 3,359
Time spent in forums: 2 Months 2 Weeks 4 Days 22 h 20 m 20 sec
Reputation Power: 1828
ManiacDan agrees: *sigh* Good work

 Viewing: Dev Shed Forums > Programming Languages - More > Other Programming Languages > Homework - Matlab. Undefined function 'Games' for input arguments of type 'double'.