Create a graphical user interface that allows the user to define a row vector x
ID: 3672671 • Letter: C
Question
Create a graphical user interface that allows the user to define a row vector x = [xmin:xstep:xmax], by entering the values of xmin, xstep and xmax. It also should be possible to define a trigonometric Matlab function (call it theFunction), by entering its name as a string. As soon as a set of valid inputs is provided, your program should create row vector x, compute f(x) = theFunction(x) and plot f(x) over x. In addition, you are asked to display a single line of Matlab instructions in your GUI that when copied from your GUI and pasted into the Matlab command window, will create a plot identical to the one shown in your GUI graphics area.
Explanation / Answer
max = 1000; xmin = 0.2675; xmax = 0.2685; ymin = 0.591; ymax = 0.592; xsize = 1000; ysize = 1000; xstep = (xmax-xmin)/(xsize-1); ystep = (ymax-ymin)/(ysize-1); result = zeros(xsize,ysize); tic(); for i = 1:xsize for j = 1:ysize x = xmin+i*xstep; y = ymin+j*ystep; x0 = x; y0 = y; k = 0; while((x*x+y*y) < 4 & kRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.