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.

P1: For the following matrices ? = [ 2.3 7.6 3.4 −5.8 ] and ? = [2.4 5.9 −6.7 9.0 ] find:

a. Matrix A time matrix B

b. Every element of matrix A times every element of matrix B

c. Determinant of matrix A

d. Transpose of matrix A

e. Subtract A from B

f. Inverse of matrix B

g. Square matrix A

h. Square every element in matrix A

i. R=inv(A)*B

j. S=A\B

P2: Let’s consider a system of 3 equations X+Y-2Z=0, X+Y+Z=1 and 2Y-Z+5=0.

a. Find the matrix of coefficients (A)

b. Find the matrix of outputs (B)

c. Solve to find the values of the variables inv(A)*B

d. Solve to find the values using equationToMatrix command (Note: you will need the symbolic library)

e. Solve using linsolve command (Note: you will need the symbolic library)

P3: For the following control system polynomial 2P3+P+P5-2P4+3P2+4=0 find the solution (roots of the polynomial)

P4: For X=-3π up to 3πin intervals of π/100.

a. Plot Y1=sin(X) as a magenta line

b. Plot Y2=cos(X) as a black double dotted line c. Plot Y1 and Y2 in the same plot without using the hold on/off command.

d. For Y3= Y1 times Y2, plot Y1, Y2 and Y3 in the same graph. Y3 will be green line. Add title, axis label and a legend.

P5: For X=0 up to 2πin intervals of π/100 with the following equations

Y4=sin(X), Y5=sin(X-0.25), Y6=sin (X-0.5), Y7=sin(X-0.75), Y8=sin(X)sin(X-0.75)

a. Plot Y4, Y5 and Y6 in the same plot. Add title, labels, legend. Plot them with different colors and line styles

b. Plot Y4, Y5, Y6 and Y7 as subplots. Add title, labels. Plot them with different colors and line styles

c. Plot Y4 and Y8 in the same plot using the hold on/off. Add title, labels. Plot them with different colors and line styles

d. Plot Y5*Y6 and Y8 in the same plot without using the hold on/off. Add title, labels. Plot them with different colors and line styles

e. Plot one of the Y equations as a 3D graph. Please add title and labels

Solutions

Expert Solution

MATLAB code is given below in bold letters.

clc;
close all;
clear all;
% Question P1
A = [2.3 7.6;3.4 -5.8];
B = [2.4 5.9;-6.7 9.0];
A*B
A.*B
det(A)
transpose(A)
A-B
inv(B)
A^2
A.^2
R = inv(A)*B
S = A\B

% Question P2
A = [1 1 -2;1 1 1;0 2 -5]
B = [0;1;0]
inv(A)*B
syms x y z
eqns = [x+y-2*z == 0,
x+y+z == 1,
2*y-z == -5];
[A,B] = equationsToMatrix(eqns)
solution = linsolve(A,B)

% Question P3
roots([1 -2 2 3 1 4])

% Question P4
X = -3*pi:pi/100:3*pi;
Y1 = sin(X);
Y2 = cos(X);
Y3 = Y1.*Y2;
figure;plot(X,Y1,'m',X,Y2,'--k',X,Y3,'g');
title('Y1(t) Y2(t) and Y3(t)');xlabel('t');
ylabel('Amplitude');legend('Y1','Y2','Y3');

% Question P5
X = 0:pi/100:2*pi;
Y4 = sin(X);
Y5 = sin(X-0.25);
Y6 = sin(X-0.5);
Y7 = sin(X-0.75);
Y8 = sin(X).*sin(X-0.75);
figure;plot(X,Y4,'m',X,Y5,'--k',X,Y6,'g');
title('Y1(t) Y2(t) and Y3(t)');xlabel('t');
ylabel('Amplitude');legend('Y1','Y2','Y3');

figure;
subplot(221);
plot(X,Y4,'m');
title('Y4(t)');xlabel('t');
ylabel('Amplitude');
subplot(222);
plot(X,Y5,'--k');
title('Y5(t)');xlabel('t');
ylabel('Amplitude');

subplot(223);
plot(X,Y6,'-g');
title('Y6(t)');xlabel('t');
ylabel('Amplitude');

subplot(224);
plot(X,Y7,'r');
title('Y7(t)');xlabel('t');
ylabel('Amplitude');


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