I dont get how we got the numbers Especially 8. 10 11. 12 EDITOR PUBLISH VIEW In
ID: 3725606 • Letter: I
Question
I dont get how we got the numbers Especially 8. 10 11. 12 EDITOR PUBLISH VIEW Insert Run Section o To Comment %.jga ind IGATE falharb Documents» MATLAB , 2o s asBreakpoints Run Run and Advance Advance Run and Time Indent RUN EDIT BREAKPOINTS Editor -/Users/nawafalharbi/Documents/MATLAB/untitled6.m | | untitled3.m xluntitled4.m ×1 untitled5·m ×1 untitled6.m : 1- clc:clear; 2-WI 1 2 3 4 5 6; 7 89 10 11 121 4- for K=1:2 fprintf('48,2f %8.2f ", w(K,K) , w(K,K+2 ) ) 8 -end Command Window 1.00 4.00 8.80 11.00 3.00 5.00 10.00 12.00Explanation / Answer
Here we have matrix with 2 rows and 6 colums like
Now we have loop which works for K= 1 and K=2 and W(K,K) means value at Kth row and Kth colum in W
Let see each one by one
K= 1
a) We are printing W(K,K) and W(K,K+2)
W(k,K) = W(1,1)
= 1
W(K,K+2) = W(1,3)
= 3
b) We are printing W(K,K+3) and W(K,K+4)
W(K,K+3) = W(1,4)
= 4
W(K,K+4) = W(1,5)
= 5
K= 2
a) We are printing W(K,K) and W(K,K+2)
W(k,K) = W(2,2)
= 8
W(K,K+2) = W(2,4)
= 10
b) We are printing W(K,K+3) and W(K,K+4)
W(K,K+3) = W(2,5)
= 11
W(K,K+4) = W(2,6)
= 12
Now we are getting values with two decimal places because we have used fprintf which is formatted printing .2f (which represent 2 decimal places) and 8 means total number of spaces taken by number to printed including '.' .
rowcol 1 2 3 4 5 6 1 1 2 3 4 5 6 2 7 8 9 10 11 12Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.