Using a for loop convert the original problem at the bottom: Define the values o
ID: 3918527 • Letter: U
Question
Using a for loop convert the original problem at the bottom:
Define the values of zeta in a vector. Use for loop to cycle through the values of zeta(zeta(k)). Save the output y as a row vector each time for loop is going to run; y(k, :), where k goes from 1 to 5 for the five values of zeta. Resultant y will be a matrix with five rows and N columns, where N is the length of the vector x that represents the x-axis. Make sure to ask user to enter vector x for which y values are calculated and plotted.
Thanks for any assistance
Explanation / Answer
X = input('Please enter input vectory X: ', ' ');
Y = []
display(X)
for i = 1:5
temp = []
for j = 1:size(X)
temp(i,j) = zeta(X(j))
end
Y = [Y;temp]
end
display(Y)
Ask user to enter input vector X. Interate over X 5 times and calculate values of zeta(). Store this in a temp row vector. Once inner loop completes, append temp vector to resultant Y vector. Finally display Y having 5 rows and N columns.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.