Question

In: Electrical Engineering

Instructions: 1. Solve the following problems in a MATLAB script. You will be allowed to submit...

Instructions: 1. Solve the following problems in a MATLAB script. You will be allowed to submit only one script, please work all the problems in the same script (Hint: careful with variables names) 2. Show your work and make comments in the same script (Use %). Please write your name in the first line of the scrip with % 3. It is OK to work with other students, but what you submit should be your own work – not something copied from someone else.

Problem #1 (10 points): Using loops show the following calculation: ? ???? 25 3 ????=1

Problem #2 (15 points): When working with computer, microprocessors or digital systems most of the commands are represented in binary numbers, hexadecimal numbers, ASCII or octal. We want to write a code that do the following a. Inputs are decimal digits from 200 to 400 counting by 10 b. When the counter find a number smaller than 300 the result will be the same number converted into hexadecimal c. When the counter find 300 display “We are at 300 from now on the numbers will be display as binary numbers” d. When the counter find an number bigger than 300 the result will be the same number converted into binary

Problem #3 (25 points): As you make decisions over your 401K, you find one investment opportunity that will draw 09% interest per year added to your account. The trick about this investment is that you will need to cancel the investment as soon as you double the amount of money you put in the first time which could be any amount from $5000 - $7000. You will received statements of the balanced for the total years you invested until the balanced is doubled. Expected from this program: • Initialize balance, year, and interest rate. Your first year is denominated at year 0. • You will need to display the balance with headings “Year” and “Balance” until the balance is twice the original. • Please display the numbers with bank format Example: Initial Balance=4500.00 Year Balance 1.00 4905.00 2.00 5346.45 3.00 5827.63 4.00 6352.12 5.00 6923.81 6.00 7546.95 7.00 8226.18 8.00 8966.53 9.00 9773.52

Problem #4 (35 points): A friend ask you to babysit their 5 year old named Kylo-Ren. After the kid tablet run out of battery and is almost at the point to start screaming, you decide to play a game. Since you are an expert in MATLAB or at least love writing some easy scripts, you decide to work a game for him. You want MATLAB to generate a random integer number that KyloRen will guess. Expected from this program: • Generate a random integer (no higher than 25). Keep in mind that a 5 year old will probably do not want to play a game if it is too long or too short. • Ask the user to input a guess. Please specify how high the guess could be. • Check the guess given for the user. If the guess is too low tell the user: “Kylo-Ren, your guess is too low, please try again and enter a new guess number”. The same thing should happen if the guess is too high. • When the guess is equal to the random number please congratulate Kylo-Ren. • If you can add sounds to the game, Kylo-Ren will be more eager to play over and over again which will give you time to watch one episode of the Big Bang Theory. Plus you can get bonus points. Example: Please enter your guess between 1 and 20: 5 Sorry your guess is too low Please enter your next guess: 15 Sorry your guess is too high Please enter your next guess: 5 Sorry your guess is too low Please enter your next guess: 10 Sorry your guess is too low Please enter your next guess: 12 Sorry your guess is too low Please enter your next guess: 14 Sorry your guess is too high Please enter your next guess: 13 At last! :)

Problem #5 (15 points): You all know I like sports, especially baseball. What is your favorite sport? Expected from this program: • Show the options in a menu form for the user for them to press either Baseball, Football, Soccer, Track and Field, Other, and Quit Survey. • When display a fun fact for each sport as follows o Baseball - display “Bobby Richardson is the only player to win an MVP on the World Series losing team” o Football – display “It takes 600 cows to make one full season’s worth of NFL footballs” o Basketball – display “ Basketball was invented by a YMCA teacher in Springfield, MA” o Soccer – display “FC Barcelona wears UNICEF logo in their shirt while donating 1.5M euros each year – Reverse sponsorship” o Track and Field – display “UNC Charlotte Men T&F Team Won C-USA Championship this year” o Other – display “ Golf: The average golf ball has 336 dimples, Tennis: Tennis balls where change from white to yellow in 1972” o Quit Survey – display “Thanks for participate” Example: Panther: Keep Pounding Broncos are my option Thanks for participate

Problem #6 (20 points): We have set up a limit in current on a piece of equipment to be 0.45 Amps. When the system is running data is gather in the DAQ. The system generates a vector of 10 random numbers in one single column. The control system is comparing if the values of the result currents are higher than the limit set for the supplier. We need to project the results into a monitor for easy understanding and to take action over the equipment. If one of the parameters in the vector has a value higher than the limit, we will need to display a message that say “There is at least one current value measure above the limit”, if this is not true, please display “All values are below the limit. You can proceed with your data acquisition”.

Solutions

Expert Solution

for x=200:10:400
if x<300
y=dec2hex(x)
elseif x==300
disp('We are at 300 from now on the numbers will be display as binary numbers');
else
y=dec2bin(x)
end
end
%-------------------

x=randi(25);
y=input('select a guess between 1 and 25: ');
while (abs(y-x)>5)
if y>x
disp('your guess is too high, try again');
elseif y<x
disp('your guess is too low, try again');
end
y=input('select a guess between 1 and 25: ');
end
disp('you have guessed it exactly ');

>> m61

y =

C8


y =

D2


y =

DC


y =

E6


y =

F0


y =

FA


y =

104


y =

10E


y =

118


y =

122

We are at 300 from now on the numbers will be display as binary numbers

y =

100110110


y =

101000000


y =

101001010


y =

101010100


y =

101011110


y =

101101000


y =

101110010


y =

101111100


y =

110000110


y =

110010000

select a guess between 1 and 25: 22
your guess is too high, try again
select a guess between 1 and 25: 1
your guess is too low, try again
select a guess between 1 and 25: 5
your guess is too low, try again
select a guess between 1 and 25: 10
your guess is too low, try again
select a guess between 1 and 25: 15
you have guessed it exactly
>>


Related Solutions

Instructions: 1. Solve the following problems in a MATLAB script. You will be allowed to submit...
Instructions: 1. Solve the following problems in a MATLAB script. You will be allowed to submit only one script, please work all the problems in the same script (Hint: careful with variables names) 2. Show your work and make comments in the same script (Use %). Please write your name in the first line of the scrip with % 3. It is OK to work with other students, but what you submit should be your own work – not something...
Please follow the instructions and solve it by C++. Thank you! What to Submit Submit the...
Please follow the instructions and solve it by C++. Thank you! What to Submit Submit the following: 1) Your .cpp file of the solution. 2) For what n value (approximately) does your computer stop producing output? Why is this? Enter your answer in the 'Comments' field when you submit the file.   So far in our study of recursion we identified a few common recursive number sequences, such as the Fibonacci numbers. Number sequences like this are not recursive algorithms themselves...
Please provide solutions to the following problems. Please use Excel to solve the problems and submit...
Please provide solutions to the following problems. Please use Excel to solve the problems and submit the Excel spreadsheet. A fair coin is tossed 15 times, calculate the probability of getting 0 heads or 15 heads A biased coin with probability of head being .6 is tossed 12 times. What is the probability that number of head would more than 4 but less than or equal to 10. You have a biased dice (with six faces numbered 1,2,3,4,5 and 6)...
Please provide solutions to the following problems. Please use Excel to solve the problems and submit...
Please provide solutions to the following problems. Please use Excel to solve the problems and submit the Excel spreadsheet. You started a new restaurant. Based on invoices for the first 30 days, you estimated your average grocery bill to be $20,000 with a standard deviation of $2000. You want to start another restaurant in a similar neighborhood and you are planning to prepare a brochure for investors and to work out a deal with a whole sale food distributor. Prepare...
Write script in Matlab to solve 1. Y=Ax where X is of dimension n by 1...
Write script in Matlab to solve 1. Y=Ax where X is of dimension n by 1 and A is of dimension m by n. 2. C= A*B where A is of dimension m by p and B is dimension of p by n. So write matlab script to obtain Y and C in above problems.
After studying the material in this module, please solve and submit the following problems from the...
After studying the material in this module, please solve and submit the following problems from the module reading assignment on Sets from Math in Society, by D. Lippman (v. 2.4): #6, 14, 16, 20, 22, 26, 30, 34, 36, 44
Instructions: You are required to use a financial calculator or spreadsheet (Excel) to solve the problems...
Instructions: You are required to use a financial calculator or spreadsheet (Excel) to solve the problems (provided on page 4) related to risk and return characteristics and stock/bond valuation. You are required to show the following three steps for each problem (sample problems and solutions are provided for guidance): (i) Describe and interpret the assumptions related to the problem. (ii) Apply the appropriate mathematical model to solve the problem. (iii) Calculate the correct solution to the problem. A company’s stock...
Directions: Solve the following problems, detailing and documenting the solutions. Additional instructions: For each problem, be...
Directions: Solve the following problems, detailing and documenting the solutions. Additional instructions: For each problem, be sure to include the (a) type of parametric or nonparametric testing being performed; (b) both null and research hypotheses; (c) critical value and test statistic; (d) p-value; and (e) both technical and contextual conclusions. 1. The back offices for the five department stores that anchor Pinelands Promenade Mall dispute whether or not they receive comparable treatment by mall management. In response, mall management hired...
Matlab project: Solve using Matlab three problems: One using the combination formula One using the permutation...
Matlab project: Solve using Matlab three problems: One using the combination formula One using the permutation of n objects formula One using the permutation of r objects out of n objects You can pick these problems from the textbook or you can make up your own questions.
Write and upload a MATLAB script to do the following. Compute the sequence S(n+1) = (2...
Write and upload a MATLAB script to do the following. Compute the sequence S(n+1) = (2 – K) S(n) – S(n-1) ;   Assume S(1) = 0, S(2) = 1; (a)    Case 1, Assume K = 1 (b)    Case 2, Assume K = 2 (c)     Case 3, Assume K = 4 Plot all of these on the same plot, for N = 1 to 20
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT