Create an algorithm that determines whether a given complex number, c , converge
ID: 3806378 • Letter: C
Question
Create an algorithm that determines whether a given complex number, c, converges within a reasonable time. The easiest way to determine convergence is to check whether the magnitude of z is less than 2 at a given iteration. If it is greater than 2, the sequence is guaranteed to blow up a few iterations later. Each value of c corresponds to a pixel on the plot – the x coordinate of the pixel is the real part of c and the ycoordinate is the imaginary part. If c is not part of the set, plot a white pixel, and if it is part of the set, plot a black pixel.
1. Write a Matlab program that plots the Mandelbrot set in the range (x -2 : 1) (y -1 : 1). The plot should be 601 x 401 pixels in size.
2. Write a Matlab program that plots the Mandelbrot set in the range (x -0.05 : -0.01) (y 0.77 : 0.81). The plot should be 501 x 501 pixels in size.
Use the imshow command to plot your image and set the maximum number of iterations for each pixel to 200.
3. Produce the plots given above in color, with the color of each pixel dependent upon the number of iterations it takes for the sequence to “blow up”.
Explanation / Answer
Algorithm
1.create a class and define real part ,imaginary part ,and the variable for finding the magnitude of z
2.create parametrized constructor for initialising values of real part and imaginary part
3.define member function in the class for calculating magnitude |z|=i*i+r*r
4. definr member function for checking magnitude and ploting
5 call the member funtions from main
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.