Question: ( a ) The function c o s ( x ) can be approximated by the following series c o s ( x ) =

(a) The function cos(x) can be approximated by the following series
cos(x)=n=0(-1)nx2n(2n)!=1-x22!+x44!+x66!+cdots
Using a loop, create line plots of the series expansion of cos(x) against xin[-,] using n=0,1,dots,4 on the same set of axes. Annotate your plot with axis labels, a title and add a legend with appropriate labels.
(b) The Sierpinski triangle is a fractal that can be generated using the following steps: starting at a point with co-ordinates (0,0)
Randomly select one of three vertex points of an equilateral triangle: bottom-left vertex (0,0), bottom right vertex (1,0) or top vertex (12,322).
Move the point half the distance from its current position to the selected vertex.
Plot the new position.
Repeat these steps a given number of times.
Use this method to produce a plot of the Sierpinski triangle using 10000 points with a point marker of size 1. Colour the points red if the bottom left vertex was selected, blue if the bottom right vertex was selected or red if the top vertex was selected.
(c)(i) Take a selfie and read in the image file using the imread() matplotlib or MATLAB function (if you don't want to use a selfie you can using the image kitten.jpg on the Moodle area for this module instead). Determine the size of the image in pixels and plot the image.
(ii) An image can be converted to sepia tone using the following conversion
Rsepia=min(0.393R+0.769G+0.189B,255),
Gsepia=min(0.349R+0.686G+0.168B,255),
Bsepia=min(0.272R+0.534G+0.131B,255).
where R,G and B are the colour values for the original image and Rsepia,Gsepia and Bsepia are the colour values for the sepia toned image. Apply this conversion to your image and plot it.
( a ) The function c o s ( x ) can be

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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!