Question

For this In-Class Exercise, you are asked to build a MATLAB code that makes a few...

For this In-Class Exercise, you are asked to build a MATLAB code that makes a few assignment statements and a logical test with random numbers. To answer this ICE, you will need to upload a screenshot of your successful run showing ALL of the outputs. Remember to use good programing skills for the code. For your outputs:

  • If your output for a step below is a single value, use a command similar to:fprintf(‘Question 5 answer: %4.3f \n,A) or

    fprintf(‘Question 5 answer: %d \n,A)

  • If your answer is a vector or an array, use a normal print by leaving off the semicolon like:A = 1:3

    Questions:

    1. Assign a random floating point number to EACH element in a 3x3 array between 0 (inclusive) and 1 (exclusive) to the variable E.

    2. Assign a random integer to EACH element in a 3x3 array between 0 (inclusive) and 10 (inclusive) to the variable F. [TRICKY QUESTION]

    3. Assign a random floating point number between 0 (inclusive) and 1 (exclusive) to the variable G THEN test ‘G’ to see if it is greater than 0.6. IF G is great than .6 display “G is greater than 0.6” and if G is less than 0.6 display “G is less than 0.6” and if G equals 0.6 display “G equals 0.6”.
      [HINT: Remember the “disp” command??]

    4. There are a few simple questions in Blackboard to answer. Be careful on their wording!

0 0
Add a comment Improve this question Transcribed image text
Answer #1

`Hey,

Note: Brother in case of any queries, just comment in box I would be very happy to assist all your queries

close all
clear all
clc
E=rand(3,3)
F=randi([0,10],3,3)
G=rand(1);
if(G>0.6)
disp('G is greater than 0.6');
elseif(G<0.6)
disp('G is less than 0.6');
else
disp('G equals 0.6');
end

Kindly revert for any queries

Thanks.

Add a comment
Know the answer?
Add Answer to:
For this In-Class Exercise, you are asked to build a MATLAB code that makes a few...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • For this In-Class Exercise, you are asked to build a MATLAB code that makes a few...

    For this In-Class Exercise, you are asked to build a MATLAB code that makes a few assignment statements and a logical test with random numbers. To answer this ICE, you will need to upload a screenshot of your successful run showing ALL of the outputs. Remember to use good programing skills for the code. For your outputs: If your output for a step below is a single value, use a command similar to:fprintf(‘Question 5 answer: %4.3f \n,A) or fprintf(‘Question 5...

  • You have been developing a Fraction class for Teacher’s Pet Software that contains several fields and...

    You have been developing a Fraction class for Teacher’s Pet Software that contains several fields and functions. a. Add four arithmetic operators, +, -, *, and /. Remember that to add or subtract two Fractions, you first must convert them to Fractions with a common denominator. You multiply two Fractions by multiplying the numerators and multiplying the denominators. You divide two Fractions by inverting the second Fraction, then multiplying. After any arithmetic operation, be sure the Fraction is in proper...

  • Can anyone help me with my C hw? Exercise 3 You will write a new program...

    Can anyone help me with my C hw? Exercise 3 You will write a new program that combines dynamically allocating an array and saving that array to a file. These are the tasks your program must perform Open an output file named "data.txt" and prepare it for writing in text mode o If the file handle is NULL, quit the program o By default, it is created and stored in the same directory as your source code file Prompt the...

  • java code please 14. Next we'll complete the setValues() method. Instead of giving you exact code...

    java code please 14. Next we'll complete the setValues() method. Instead of giving you exact code I'll tell you what to do. Use other code as a guide.  Start with a for loop with a start of int i = 0  Set the ending point of when i is less than the length of the arr array.  Set the incrementation to increase i by 1 using the unary operator ++.  Within the loop set the arr...

  • Create a UML diagram to help design the class described in exercise 3 below. Do this...

    Create a UML diagram to help design the class described in exercise 3 below. Do this exercise before you attempt to code the solution. Think about what instance variables will be required to describe a Baby class object; should they be private or public? Determine what class methods are required; should they be private or public? 3. Write Java code for a Baby class. A Baby has a name of type String and an age of type integer. Supply two...

  • . In the method main, prompt the user for a non-negative integer and store it in...

    . In the method main, prompt the user for a non-negative integer and store it in an int variable num (Data validation is not required for the lab). Create an int array whose size equals num+10. Initialize the array with random integers between 0 and 50 (including 0 and excluding 50). Hint: See Topic 4 Decision Structures and File IO slides page 42 for how to generate a random integer between 0 (inclusive) and bound (exclusive) by using bound in...

  • In this exercise, you will create a script called if_then_else.sh that uses an IF THEN ELSE...

    In this exercise, you will create a script called if_then_else.sh that uses an IF THEN ELSE statement. The if_then_else.sh script will Use one command line argument, which will be a number between 1 and 10 Assign the value of the first argument to a local variable called NUM. HINT: Look at line 5 in the example screenshot for arguments.sh Use one IF THEN ELSE statement to compare the value of NUM If the number is less than 5, display the...

  • please answer correctly and follow the code structure given [JavaFX/ Exception handing and text I/O] 1....

    please answer correctly and follow the code structure given [JavaFX/ Exception handing and text I/O] 1. Write a program for the following. NOTE that some of these steps are not dependent on each other. Using methods is mandatory. Make sure to use methods where it makes sense. a. Ask the user for a series of integers entered from the keyboard. Use a sentinel value such as 999 to end the input process. If the entered values are not integers, throw...

  • A method called linearSearch(), which takes as parameters an array of int followed by three values...

    A method called linearSearch(), which takes as parameters an array of int followed by three values of type int, and returns a value of type int. The first int parameter represents a key, the second int parameter represents a starting position, and the third int parameter represents an end position. If the key occurs in the array between the start position (inclusive) and the end position (exclusive), the method returns the position of the first occurrence of the key in...

  • the picture above is the one you are supposed to use for the MATlab code please...

    the picture above is the one you are supposed to use for the MATlab code please help Problems. Grayscale images are composed of a 2D matrix of light intensities from O (Black) to 255 (White). In this lab you will be using grayscale images and do 2D-array operations along with loops and iflelse branches. 1. We can regard 2D grayscale images as 2D arrays. Now load the provided image of scientists at the Solvay Conference in 1927 using the imread)...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT