ENEL101 Problem set 1 Basic Matlab Calculations

$30.00

Category: Tags: , , , You will Instantly receive a download link for .zip solution file upon Payment || To Order Original Work Click Custom Order?

Description

5/5 - (6 votes)

Please read the file, “How to complete and upload the solution template” before you begin. Download
assign1.m and fill it in and then upload the completed file on D2L drop-box for Assignment 1. Also
download test_assign1.m and assign1_solutions.mat to test your answers as you go. Make sure your
name and UCID are correctly filled out in the assign1.m file (you won’t get a mark otherwise.
This, and all subsequent assignments, are marked by an auto-checker. Thus, ensure you do not
initialize input variables (like �) yourself; read the code and notice that inputs are always
initialized by the code at the top so the auto-checker can test your code with different input
values. Please follow the solution template to ensure the auto-checker doesn’t crash – especially do
not change anything outside of the question functions. Any deliberate attempts to crash the autochecker using malicious code will be considered academic misconduct and will be reported to the
Associate Dean (Student Affairs). The auto-checker will also check for plagiarism and copying an
assignment will be considered academic misconduct and will be reported to the Associate Dean (Student
Affairs).
Note the assignment questions refer to variable Q, but this will not usually be assigned in your function
call; just use the return variable “answer =”.
Note that when you it says “given x=0.2” that literally means x has been set to 0.2 in the code already
and you will work with x as a variable name. (The solutions that have been provided use x=0.2 but the
auto-checker will use a different value of x to check your work.) This is in fact the case for all numbers
given in the Chapter 1 questions – use the variable names in your calculations.
All angles are in radians.
Questions from Chapter 1
1. Given � = 0.2 calculate the following expression: � = 5 �*.+ cos � * �0.
2. Given � = 0.2 and calculate the following expression: � = ln � − tan � *.
3. Given � = 1.5 and � = 0.5 compute � = cos (
9:;
< )
4. Given � = 8.3 and � = 2.4, evaluate
� = �* + �* − 9;
:;.
ENEL101 Assignment 1 Page 2
5. In question 4 assume that � = 2�. Find � given � = 2.1.
6. Given � = 2 and � = 3, find the solution of 2 2 A x B xy Q A B == = , , tan( ).
7. The equation that identifies the response of a particular circuit is
� = − �
2� +

2�
*
− 1
��
Determine the value of � for � = 800Ω, � = 1�F and � = 1�H.
8. The number of combinations Q of taking � objects out of � objects is given by ( )
!
! !
n Q
rnr = – .
Determine the number of combinations of taking 2 cards from a deck of 52 cards. Use the built in
function factorial.
9. The current � (in amps) � seconds after closing the switch in a series RL circuit is
� = M
N
1 − �OP
QR .
Given � = 120 volts, � = 240Ω and � = 0.5 henrys, calculate the current 0.003 seconds after the
switch is closed.
10. The formula for changing the base of a logarithm is:
���W � = YZ[\ ]
YZ[\ W.
Calculate � = log_ 0.085 using Matlab’s log � function.
Questions from Chapter 2
11. Create a column vector � that has the following elements: 0*
0.*; , sin* <
0 , 6.1, ln 29*, and 133.
12. Create a row vector � in which the first element is 3 and the last element is 38, with an increment of
5 between the elements as (3,8,…,38).
13. Define the variables � = 0.5 and � = 1 and generate a 3×3 diagonal matrix � with diagonal values
of �, sin �� and tan :
9
. Use the function diag() for this purpose
14. Use the eye command to create a 4×4 identity matrix
� =
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
.
ENEL101 Assignment 1 Page 3
15. Form a 3 2 ´ matrix � with the columns of (1,1,1) and (2,2,2).
16. Create the following matrix,
103
104
105
106
107
Q
é ù
ê ú
ê ú
= ê ú
ê ú
ê ú
ê ú ë û
by using linspace, zeros, ones and the transpose operator. Do not type in the individual elements
explicitly.
NOTE: You may transpose a vector/matrix using transpose([x y]) or a single quote [x y]’
17. Create the following matrix � given as
123456
7 8 9 10 11 12
13 14 15 16 17 18
Q
é ù
ê ú =
ë û
From this create the following variable:
Create a six element row vector named X that contains the elements of the second row of �.
18. Using zeros, and ones commands create the following matrix
� =
1 1 1 1
0 0 0 0
0 0 0 0
1 1 1 1
.
19. Given matrices � = 1 1
1 1 and � = 0 0
0 0 , create the matrix � such that
� = [� �].
20. Base on the matrices �, � in question 19 create a matrix � such that