MATLAB Basic Functions - Std Quiz
30 Questions
0 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

What does the 'std' function in MATLAB calculate?

  • Median
  • Mean
  • Variance
  • Standard deviation (correct)

How can you find the standard deviation of each row in a matrix using 'std' in MATLAB?

  • std(a,2) (correct)
  • std(a,1)
  • std(a,:)
  • std(:,a)

What does the 'zeros' function in MATLAB do?

  • Calculates the sum of all elements in an array
  • Creates an array with non-zero values
  • Generates random values ranging between 0 and 1
  • Creates an array with a selected size containing zeros (correct)

To create a square sized matrix with zeros using 'zeros' in MATLAB, what syntax should be used?

<p>zeros(a,a) (B)</p> Signup and view all the answers

'rand' function in MATLAB generates random values ranging between which range?

<p>0 and 1 (C)</p> Signup and view all the answers

How does the 'ones' function in MATLAB differ from the 'zeros' function?

<p>'ones' creates arrays with only ones instead of zeros. (A)</p> Signup and view all the answers

Which function is used in MATLAB to generate a square-sized matrix with random values between 0 and 1?

<p>rand(a,a) (B)</p> Signup and view all the answers

To generate a single random integer ranging between 10 to 20 in MATLAB, which function should be used?

<p>randi([10,20]) (D)</p> Signup and view all the answers

Which MATLAB function creates a vector with elements linearly spaced between specified values?

<p>linspace(start, end, size) (D)</p> Signup and view all the answers

What does the 'rand(1)' function in MATLAB do?

<p>Generates a scalar with a random value between 0 and 1 (D)</p> Signup and view all the answers

How is the 'randi([5,10],3,2)' MATLAB function interpreted?

<p>Generating a 3x2 matrix with integers between 5 and 10 (D)</p> Signup and view all the answers

In MATLAB, how is the 'linspace(1,10,5)' function used?

<p>Creating a vector with elements linearly spaced from 1 to 10 (A)</p> Signup and view all the answers

What does the 'sort' function do in MATLAB?

<p>Sorts elements of a variable in ascending or descending order (C)</p> Signup and view all the answers

How can you use the 'sort' function to sort values in each column of a matrix?

<p>sort(a,1,'ascend') (A)</p> Signup and view all the answers

What does the 'disp' function do in MATLAB?

<p>Displays all the elements in an existing variable (B)</p> Signup and view all the answers

How can you use the 'disp' function to display the elements of a variable named 'b'?

<p>disp(b) (C)</p> Signup and view all the answers

'roots' function in MATLAB is primarily used for finding:

<p>Roots of a polynomial function (D)</p> Signup and view all the answers

'save' function in MATLAB is primarily used for:

<p>Storing variables defined in the current workspace (A)</p> Signup and view all the answers

What is the correct way to find the cosine of a variable named (a) in MATLAB?

<p>cos(a) (D)</p> Signup and view all the answers

Which function in MATLAB finds the hyperbolic sine value of a scalar or all elements of an array?

<p>sinh(a) (B)</p> Signup and view all the answers

What range should the input value be in to use the 'acos' function in MATLAB?

<p>-1 to 1 (C)</p> Signup and view all the answers

Which function in MATLAB finds the tangent value of a scalar or all elements of an array?

<p>tan(a) (D)</p> Signup and view all the answers

What is the correct way to find the arc-tangent of a variable named (a) in MATLAB?

<p>atan(a) (A)</p> Signup and view all the answers

For the 'atan' function in MATLAB, what is the range of the output value for any real number input?

<p>-π/2 to π/2 (B)</p> Signup and view all the answers

What does the 'sum' function do when used after checking a logical condition in MATLAB?

<p>Counts the number of elements that satisfy the set condition (C)</p> Signup and view all the answers

In MATLAB, what does the command 'sum(sum(a>0))' calculate?

<p>Total number of positive numbers in array a (B)</p> Signup and view all the answers

How can you find the position of the number 6 in a variable named 'a' in MATLAB?

<p>find(a==6) (A)</p> Signup and view all the answers

What does the command 'sum(sum(a>1 & a>mean(a(find(a>0))))' calculate in MATLAB?

<p>Number of elements in a larger than 1 and greater than the mean of positive elements (A)</p> Signup and view all the answers

How can you calculate the percentage of positive numbers in a variable named 'a' in MATLAB?

<p>(sum(sum(a&gt;0))/numel(a))*100 (C)</p> Signup and view all the answers

What is the purpose of the command 'linspace(1,10,10)' in MATLAB?

<p>Generate a vector from 1 to 10 with 10 evenly spaced elements (C)</p> Signup and view all the answers

More Like This

MATLAB - Prehľad a jednoduché výpočty
43 questions
Matlab Lektion 1-4
33 questions

Matlab Lektion 1-4

PleasurableSilver6540 avatar
PleasurableSilver6540
Use Quizgecko on...
Browser
Browser