Question: Converting polar and Cartesian vector representations using functions and structures. A vector is a mathematical quantity that has both magnitude and direction. A 2-dimensional

Converting polar and Cartesian vector representations using functions and structures. A vector

is a mathematical quantity that has both magnitude and direction. A 2-dimensional

Converting polar and Cartesian vector representations using functions and structures. A vector is a mathematical quantity that has both magnitude and direction. A 2-dimensional vector can be represented as a displacement along xx and yy axes in rectangular (Cartesian) coordinates or, by a distance rrand an angle $$ in polar coordinates, The relationships between the Cartesian (x,y)(x,y) and polar (r.)(r.) coordinates are given by the following equations, xyr=rcos(0)=rsin(0)=x2+y2 x=rcos(0)y=rsin($)r=x2+y2 Write a MATLAB function getPolar(inputCartesianStruct) that takes a structure inputCartesianStructas input, that has two components x and y. Then on output, it returns another structure that has to components r and phi. Write another function getCart(inputPolarStruct) that does the inverse of getPolar(inputCartesianStruct). Make sure that both functions are robust to wrong input structures by checking whether the input structures have the required fields: x and y, or r and phi. You can do so by using MATLAB's builtin function isfield(). 3. Converting polar and Cartesian vector representations using functions and structures. A vector is a mathematical quantity that has both magnitude and direction. A 2-dimensional vector can be represented as a displacement along x and y axes in rectangular (Cartesian) coordinates or, by a distance r and an angle in polar coordinates, AY P 1 r sin o X r cosp The conversion rule between the Cartesian and Polar representations of a vector. The relationships between the Cartesian (x, y) and polar (r, d) coordinates are given by the following equations, x = r cos(p) y = r sin(p) x + y r = Write a MATLAB function getPolar (inputCartesianStruct) that takes a structure inputCartesianStruct as input, that has two components x and y. Then on output, it returns another structure that has to components and phi. Write another function getCart (input PolarStruct) that does the inverse of get Polar (inputCartesianStruct). Make sure that both functions are robust to wrong input structures by checking whether the input structures have the required fields: x and y, or r and phi. You can do so by using MATLAB's builtin function isfield ().

Step by Step Solution

3.30 Rating (156 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Answer get polar asking the user to give the x and y values for the structure x inputE... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!