Question

Consider the following Matlab script. a) Is any of the variables used in this script of array (vector) type ? If so, give the name(s) of the variable(s). b) What is the term 'length(a)' used for? c) What is the numerical value for the variable 'tot' at the end of this script ? d) Rewrite the given script such that 'for'loop breaks when the 'tot' > 5 clear all; a = [1,2,3,4,5]; tot = 0; for i = 1 : length(a) tot = tot + a(i)^2; end % Print the numerical value for 'tot' to the screen tot

          Consider the following Matlab script.
a) Is any of the variables used in this script of array (vector) type ? If so, give the name(s) of the variable(s).
b) What is the term 'length(a)' used for?
c) What is the numerical value for the variable 'tot' at the end of this script ?
d) Rewrite the given script such that 'for'loop breaks when the 'tot' > 5
clear all;
a = [1,2,3,4,5];
tot = 0;
for i = 1 : length(a)
    tot = tot + a(i)^2;
end
% Print the numerical value for 'tot' to the screen
tot
        
Show more…
Consider the following Matlab script.
a) Is any of the variables used in this script of array (vector) type ? If so, give the name(s) of the variable(s).
b) What is the term 'length(a)' used for?
c) What is the numerical value for the variable 'tot' at the end of this script ?
d) Rewrite the given script such that 'for'loop breaks when the 'tot' > 5
clear all;
a = [1,2,3,4,5];
tot = 0;
for i = 1 : length(a)
    tot = tot + a(i)^2;
end
% Print the numerical value for 'tot' to the screen
tot

Added by Kristine L.

Close

University Physics with Modern Physics
University Physics with Modern Physics
Hugh D. Young 14th Edition
AceChat toggle button
Close icon
Ace pointing down

Please give Ace some feedback

Your feedback will help us improve your experience

Thumb up icon Thumb down icon
Thanks for your feedback!
Profile picture
Consider the following Matlab script. a) Is any of the variables used in this script of array (vector) type? If so, give the name(s) of the variable(s). b) What is the term 'length(a)' used for? c) What is the numerical value for the variable 'tot' at the end of this script? d) Rewrite the given script such that the 'for' loop breaks when 'tot > 5'. clear all; a = [1,2,3,4,5]; tot = 0; for i = 1 : length(a) tot = tot + a(i)^2; if tot > 5 break; end end % Print the numerical value for 'tot' to the screen tot
Close icon
Play audio
Feedback
Powered by NumerAI
Jennifer Stoner Danielle Fairburn
Ivan Kochetkov verified

Akash M and 85 other subject Physics 101 Mechanics educators are ready to help you.

Ask a new question

*

Labs

-

Want to see this concept in action?

NEW

Explore this concept interactively to see how it behaves as you change inputs.

View Labs

*

Key Concepts

-
Key Concept
Premium Feature
Explore the core concept behind this problem.
Play button
Key Concept
Premium Feature
Explore the core concept behind this problem.
Your browser does not support the video tag.

*

Recommended Videos

-
the-variable-t-after-these-commands-v-1333t-vend-will-be-33-32-31-none-of-the-above-the-variable-t-after-these-commands-t-16-41-2-will-be-a-4-element-vector-4x4-matrix-scalar-none-of-the-abo-54815

The variable t after these commands v = 1.3.33; t = Vend) will be: 33 32 31 None of the above. The variable t after these commands t = (16:-4:1) ^ 2 will be: a 4-element vector 4x4 matrix scalar None of the above: MATLAB will print an error message The value of p after this command: A = [1:4; 5.8; 9.12]; p = size(A); will be 12 will be a 3-by-4 matrix will be a 2-element vector

Akash M.

10-points-create-the-following-two-row-vectors-d6-1-4-0-2-5-and-e7-5-9-0-1-3-a-use-the-two-vectors-in-a-matlab-command-to-create-matrix-such-that-the-first-row-consists-of-elements-1-through-59557

[10 points] Create the following two row vectors: d=[6 -1 4 0 -2 5], and e=[7 5 9 0 1 3]. (a) Use the two vectors in a MATLAB command to create a matrix such that the first row consists of elements 1 through 3 of vector d, the second row consists of elements 2 through 4 of vector e, and the third row consists of elements 3 through 5 of vector d. (b) Use the two vectors in a MATLAB command to create a matrix such that the first column consists of elements 1 through 4 of vector d, and the second column consists of elements 2 through 5 of vector e.

Sri K.

in-matlab-notation-write-the-commands-that-define-the-matrix-a-and-the-column-vectors-x-and-b-what-c

In MATLAB notation, write the commands that define the matrix $A$ and the column vectors $x$ and $b$. What command would test whether or not $A x=b$ ? $$ A=\left[\begin{array}{ll} 1 & 2 \\ 3 & 4 \end{array}\right] \quad x=\left[\begin{array}{r} 5 \\ -2 \end{array}\right] \quad b=\left[\begin{array}{l} 1 \\ 7 \end{array}\right] $$

Linear Algebra and Its Applications

Matrices And Gaussian Elimination

Matrix Notation and Matrix Multiplication


*

Recommended Textbooks

-
University Physics with Modern Physics

University Physics with Modern Physics

Hugh D. Young 14th Edition
achievement 1,395 solutions
Physics: Principles with Applications

Physics: Principles with Applications

Douglas C. Giancoli 7th Edition
achievement 1,961 solutions
Fundamentals of Physics

Fundamentals of Physics

David Halliday, Robert Resnick , Jearl Walker 10th Edition
achievement 1,753 solutions

*

Transcript

-
00:02 Hello students, so let us look at this question.
00:04 First of all the variable t, the variable t after v is equal to 1 .3 .33 where t is equal to v end and which whose value is 33.
00:25 Similarly for second one the variable t, variable t after t dash is equal to 16 which is equal to minus 4 is to 1 and the whole square, the whole square is a 4 element factor is a 4 element factor and at the third we can say that the value of p, the value of p after a dash is equal to 1 is to 4, 5 .8 and 9 .2...
Need help? Use Ace
Ace is your personal tutor. It breaks down any question with clear steps so you can learn.
Start Using Ace
Ace is your personal tutor for learning
Step-by-step explanations
Instant summaries
Summarize YouTube videos
Understand textbook images or PDFs
Study tools like quizzes and flashcards
Listen to your notes as a podcast
Continue solving this problem
Create a free account to:
  • View full step-by-step solution
  • Ask follow-up questions with Ace AI
  • Save progress and study later
Continue Free
Numerade

Get step-by-step video solution
from top educators

Continue with Clever
or



By creating an account, you agree to the Terms of Service and Privacy Policy
Already have an account? Log In

A free answer
just for you

Watch the video solution with this free unlock.

Numerade

Log in to watch this video
...and 100,000,000 more!


EMAIL

PASSWORD

OR
Continue with Clever