Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

why is it weong and can you help? 1. [Submit on zyLabs) Write a function called orbit that takes three inputs and returns three outputs.

why is it weong and can you help? image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
1. [Submit on zyLabs) Write a function called orbit that takes three inputs and returns three outputs. Our function is related to a planet that is in orbit around a star. Remember that planets have elliptical orbits, like this: Image from https:/upload.wikimedia.orgeslapedia Commons Picture_of_an_elliptical_orbit pe An ellipse has two measurements that we can use define it. Those are the major axis radius (a in the picture) and the minor axis radius ( in the picture below) Image from Lipspload daar wikipedia ban d anar_ 1200ps-Ep Your function should take information about your planet's orbit and tell us how long that orbit will take. Your three inputs should be: The major axis radius, major - The minor axis radius, minor. - The planet's orbital velocity, velo, in meters per second Your outputs should be the length of one year on that planet, in days, using three approximations for the perimeter of an ellipse - A circular approximation, circTime. - Using Ramanujan's first approximation, ramlTime. - Using Ramanujan's second approximation, ram2 Time This means that when you call your function, it should have the form: (circTime, ramiTime, ram2Time] - orbit (major, minor, velo); The circular approximation is: Ramanujan's first approximation is: perimeter [3(a + b)-(3a + b)(a + 3b)] Ramanujan's second approximation is: (a - b) perimeter (a + b)(1+ - 10+ 14-37) where h= Note that those equations give you perimeters. To calculate the time it takes to travel that distance, you have to divide a perimeter by a velocity. Then remember to convert the time to the correct units (days). To test your code, use these inputs: Input a (km) b (km) v (km/s) Earth Data 149600000 149580000 29.78 You should find Output circ Time Time in Days 3.652952252479330+02 raml Time ram2 Time 3.652952248398216e+02 3.652952248398215e-02 Note that earth's orbit is indeed very close to a circle! Srinivasa Ramanujan was an Indian mathematician. Click here to read more about him! - You must name your function orbit The first output MUST be the time with the circular approximation The second output MUST be the time with Ramanujan's first approximation The third output MUST be the time with Ramanujan's second approximation The first input MUST be the major axis length The second input MUST be the minorjaxis length The third input MUST be the orbital velocity Function Save C Reset MATLAB Documer orbit.m 3 % function named orbit with three arguments and three return values 4 function (circTime, rami Time, ramTime) - orbit(major, minor, velo) 5 % using long format as required in result 6 format long; 7a - major: sb-minor; 9 V - velo; 10 days - 86400; 11 * calculating number of days using velocity and second 12 circTime - (2pi sqrt( (a^2 + b^2)/2 )/V)/days; 13 ramlTime - (pi*(3*(a+b) . sart((3*a+b)*(+3*b)))/V)/days; 14 h - ((a-b)^2)/((a+b)^2); 15 ran2Time - (pi"(a+b)*( 1.39h/(10 sqrt(4-3*)))/V)/days; 16 end Code to call your function 1 [circt, ranit, ram2T] - orbit(149600000, 149580000, 29.78) Run Function Previous Assessment: 0 of 2 Tests Passed Submit * Earth Numbers Your function did not perform correctly with earth numbers. This means you probably have an error in your code Random Numbers Your function did not work with at least one randomly generated value. If the first test passes, this means you are probably hard-coding values to your inputs. Don't do that! To generate random inputs, use this code a = rand 50 + 10000000; b = rand 50 + 1000000e; V = rand"3ee

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

2. (1 point) Given AABC, tan A b b

Answered: 1 week ago

Question

3. Identify cultural universals in nonverbal communication.

Answered: 1 week ago

Question

2. Discuss the types of messages that are communicated nonverbally.

Answered: 1 week ago