Question: MATLAB Question: Write a script for the problem pictured. Please send the script, not just the printout. Make sure your script allows you to input
MATLAB Question: Write a script for the problem pictured. Please send the script, not just the printout. Make sure your script allows you to input a value for n
so when prompted, in the command window, user types n value. The n value should be the f_k if k ==1 .... Please also send print outs if you can.
BELOW IS A SAMPLE ANSWER THAT DID NOT PUT THE INPUT SCRIPT NEEDED FOR THIS QUESTION TO BE CORRECT. YOU CAN USE IT TO COME UP WITH A SCRIPT THAT DOES USE AN N INPUT (like n = ( 'input n ');)

I have named the function as fk.
The following code has to be copied into a file named fk.m
function y = fk(k) if (k == 1) y = 1; % ACCORDING TO THE PROBLEM, THIS SHOULD PRINT n, NOT 1. elseif(k > 1 && k
============================
Now in a different file you copy this code
x = 1:10; y = []; %start with an empty vector
%iterate over x value for k = 1:10 y = [y , fk(k)] ; %append the value of function to vector end
%now use x and y values and star marker to plot the graph plot(x, y, '*')
The above code will produce the following output
P4.1.11 Write a script that inputs a positive integer n and then generates a length-10 row vector f according to the following formula: 1n ifk=1 k-1 fk-1/2 if 10 k1 and fk- is even. Your seript should plot the points (1.f10, fio) using the star marker
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
