Question
Use matlab please Problem 2 Use a function (polar rose or spiral or anything else reasonable) to create (x,y) points. Move it to a new
Use matlab please
Problem 2
Use a function (polar rose or spiral or anything else reasonable) to create (x,y) points. Move it to a new location using a rotation followed by a translation. Plot it again. Extra credit: Plot multiple copies in a circle or a grid or some other pattern using a for loop.
Deliverables:
Script to create the function and do the plot
Function to create x,y values
Put x,y values into a 3xn matrix
Use a matrix to move the points
Picture with your original and moved points
EC: Plot with multiple copies. Must use a loop (dont do it by hand)
Step by Step Instructions:
Create x and y points using either a spiral or a polar rose
Polar rose: r(t) is cos( n/d *t ) I used n = 4, d = 3 in the plot below
Spiral: r(t) is sqrt(t) (see lecture script)
x(t) = r(t) * cos(t)
y(t) = r(t) * sin(t)
Plot and make sure you have either a spiral or a rose. Use axis equal to make sure the aspect ratio is correct
Note: You can do anything you want here just produce x and y points that make an interesting plot one that you can tell if you rotated it correctly or not
Turn your x and y vectors into a 3xn matrix where n is the length of x and y
pts = [x; y; ones( 1, length(x) ) ]
Copy your mTrans and mRot code from the previous problem
Multiply the matrics by the points
ptsNew = mTrans * mRot * pts
Plot the new points. Notice that ptsNew is also a 3xn matrix with ones in the 3rd row ignore those
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started