A MATLAB code to compute sum of cube-of-each-element of a vector v is given by: s=0; v=[10 5 8]; for i=l:length(v); v(i^2)*v(i); s=S - end; s=(s)^(1/3); |(a) This code however has a bug. Fix the bug and write the correct code. (b) What is the value sum of cube-of-each-element of the vector v?

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter15: Recursion
Section: Chapter Questions
Problem 8SA
icon
Related questions
Question

struggling please help 

A MATLAB code to compute sum of cube-of-each-element of a vector v is given by:
s=0; v=[10 5 8];
for i=1:length(v);
v (i^2)*v(i);
S=S
end;
s=(s)^(1/3);
(a) This code however has a bug. Fix the bug and write the correct code.
(b) What is the value sum of cube-of-each-element of the vector v?
Submit I Attempts 1 |
Transcribed Image Text:A MATLAB code to compute sum of cube-of-each-element of a vector v is given by: s=0; v=[10 5 8]; for i=1:length(v); v (i^2)*v(i); S=S end; s=(s)^(1/3); (a) This code however has a bug. Fix the bug and write the correct code. (b) What is the value sum of cube-of-each-element of the vector v? Submit I Attempts 1 |
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Hyperlinks
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning