I have calculated the outputs for a polynomial that I want to insert into the co
ID: 3655709 • Letter: I
Question
I have calculated the outputs for a polynomial that I want to insert into the column of a matrix. I have 3 polynomials and want my matrix size to be n * 3. How do i set the first outputs to the first column and then repeat for the other two polynomials. So I want outputs from 000 to 222 for sum to be in the first column such as matrix [sum1 sum2 sum3]. How do i first assign the sum1 to column 1 and then add two more sums after to combine everything into one matrix. My current code is clear all;clc; a=3; b=4;c=5; for x=0:2 for y=0:2 for z=0:2 sum1=(a*x)+(b*y)+(c*z); str=sprintf('f(%d,%d,%d)=%d',x,y,z,sum1); disp(str); end end endExplanation / Answer
%closest I can figure from your comments clear all;clc; a=3; b=4;c=5; count=1; for x=0:2 for y=0:2 for z=0:2 sum(count,1)=(a*x)+(b*y)+(c*z); sum(count,2)=(3*a*x)+ (2*b*y)+(4*c*z); sum(count,3)=(2*a*x)+ (3*b*y)+(4*c*z); count=count+1; end end end
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.