Ask your own question, for FREE!
Mathematics 10 Online
OpenStudy (raffle_snaffle):

Matlab help

OpenStudy (raffle_snaffle):

Need help, this mini program is pissing me off...

OpenStudy (mjdennis):

Can you post it? (And is it a math problem, or Computer Science?)

OpenStudy (raffle_snaffle):

matlab and I just figured it out.

OpenStudy (raffle_snaffle):

%% Problem 9.1 %{ Use a for loop to sum the elements in the following vector: x = [1, 23, 43, 72, 87, 56, 98, 33] %} % vectors given in problems, assign new variable c9p1 = [1, 23, 43, 72, 87, 56, 98, 33]; sum = 0; for k = 1:length(c9p1) sum = sum + c9p1(k); end disp('The sum of c9p1 is: %f', sum); shy doesn't disp work like this?

OpenStudy (raffle_snaffle):

@mjdennis

OpenStudy (raffle_snaffle):

never mind I am using fprintf() it's better, less coding.

OpenStudy (mjdennis):

Yeah, if I remember 'disp' correctly, you can do disp('words') or disp(variable), but i'm not sure it does both at once. And disp definitely doesn't use %f formatting. In fact, the 'f' in 'fprint' stands for 'formatted print'. Glad you got it!

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!