%This is the modified myfile.m m-file. This m-file makes several function calls. % The details of the functions are: % A function to check if a number is odd or even % A function that evaluates and returns the result of the equation % f(x) = -x/(x^2+a^2) % A function that plots results. % first intialize an array a with all numbers from 1 to 100 a = [1:100]; %intialize a variable b with 3 b = 3; % here i cycle through all the elements in a one by one and ...... for i = 1:max(size(a)) % loop through all ements of a % .......I call function chkevod (for check even or odd) which accepts the present element of a and the number 2 as inputs and % the resulting output of this function is put in variable rmndr (remainder) rmndr = chkevod(a(i),2); % call function chkevod % if the remainder is zero, I evaluate the function within the "if" statement ie I evaluate the function and assign the result into % an array c only if the independent variable 'a(i)' is even if rmndr == 0 c(i) = sin(a(i))+b; end % I make a call to function getrslt (get result) regardless of the a(i) being even or odd and assign the result to an array f f(i) = getrslt(a(i),b); % call function get result, which evaluates the function f(x) = -x/(x^2+a^2) end % Now I initialize a figure window with the command figure figure(1) % and call the function plotter which accepts the array f as its input plotter(f) % I do the same with another figure window figure(2) plotter(c)