Objective: To provide practice (or a refresher) with writing simple MATLAB codes that employ common tools such as loops, functions, arrays, and MATLAB plotting tools.
P T 1: Functions and loops
The goal of this exercise is to plot the function
r(theta) = theta
where theta is a phase angle and r(theta) is the radius at that
angle, over the range - 3pi/2 =< theta =< 3pi/2 .
It is often useful to define a function to handle calculations that will be performed over and over again. Designing your code this way presents several advantages:
•Individual functions that can build specific tasks can be built and tested separately from the rest of the code. this not only can make your program easy to debug, it breaks the programming tasks into smaller more manageable chunks that can potentially be shared among multiple coders.
•Functions can be used by more than one program - so if you've written a function that does something useful, you can reuse it if you need to perform the same task in another program.
We will write a simple program that plots the above function using a main program and a nction. In teams of two, decide which person will take the lead on the nction and which person will take the lead on the main program.
The FUNCTION should take as input the phase angle theta and return as output the Cartesian (x,y) coordinates corresponding to the point (theta,r(theta)) (defined as above). Recall that the following functions can be used to convert polar coordinates to Cartesian coordinates:
X = rcos(theta) y = rsin(theta)
For help with the syntax r nctions in MATLAB, type
help function
on the command line in MATLAB.
The MAIN PROGRAM should use a loop to pass phase angles one-at-a-time to the function over the range of inputs, collect the outputs, and then plot the results. For help with the syntax of loops in MATLAB (and to help consider what kind of loop would be appropriate here), use the MATLAB help to and out more about the following:
for if while
Part 2:
Passing arrays to functions
Repeat the above exercise,but instead of using a loop to pass individual values of theta to the function,the main program should define a vector of all values of theta that should be used, and pass the whole vector to the function. What needs to be changed in the function, if anything, to accommodate this change? Once these changes are made, will the function still work when scalar values of are passed to it? (If not, try to make the necessary changes so that the function will work for both scalar and vector inputs.)
In: Electrical Engineering
When a message is sent electronically it is usually sent as a
stream of bits, each of which can be either a 0 or a 1. If the
digital channel is noisy then each
bit has some probability of being flipped (ie changed from a 0 to a
1 or vice versa) resulting in a corrupted message.
Assume that a message is being sent through a noisy channel where
the probability that any individual bit will be flipped is 0.1.
What is the probability that
a message 4 bits long would be successfully transmitted? (Answer to
three decimal places).
____________
One method of dealing with the problem of bits being flipped is to
use a Hamming code. This involves sending extra bits along with the
message that can
be used to check the main message. For example a 7 bit Hamming Code
contains 4 bits of message data and 3 check bits. If only one of
the bits is in
error at the receiving end then mathematical techniques can be used
to determine which one it is and apply a correction. However, if
more than one bit is
flipped then an erroneous correction will be applied and the
message will still be corrupted.
Assume that a message is being sent through a noisy channel where
the probability that any individual bit will be flipped is 0.1 as
before. If the message is
sent using a 7 bit hamming code what is the probability that it
will get through with no more then one of the seven bits being
flipped? (Answer to three
decimal places).
____________
If we are concerned with the possibility that 2 bits have been
flipped then instead of using the correction mentioned above we can
ask for the 7 bits to be
re-transmitted. However, there is the possibility that when more
then 3 bits have been flipped that the final corrupted message will
correspond to a
message where the Hamming code thinks that none of the bits have
been flipped. The probability of this occurring when 3 or 4 bits
have been flipped is
0.2. It does not occur if 5 or 6 bits have been flipped (similar to
1 or 2 bits being flipped). It always occurs if all 7 of the bits
have been flipped.
Assume that a message is being sent through a noisy channel where
the probability that any individual bit will be flipped is 0.1 as
before. A 7 bit Hamming
code is being used. When the message is decoded at the receiving
end the procedure indicates that none of the bits have been
flipped. What is the
probability that the message that was received that appears to have
no bits flipped is in fact an error with 3 or more bits flipped?
(Answer to three decimal
places).
____________
Assume that a message is being sent through a noisy channel where
the probability that any individual bit will be flipped is 0.1 as
before. A 7 bit Hamming
code is being used. When the message is decoded at the receiving
end the procedure indicates that at least one of the bits have been
flipped. Therefore
the 7 bit message is re-transmitted. What is the probability that
if the decoding procedure is applied to both transmissions that
both times will result in the
correct 7 bit message (including the case where the second
transmission does not need any unflipping)? (Answer to three
decimal places).
____________
In: Electrical Engineering
Compare the car assembly process with nanotechnology self-assembly. How are the nanocomponents moved and oriented?
In: Electrical Engineering
Analog-to-Digital convertor, modified. Assume that you have a 12-bit A/D converter that can digitize an analog voltage over the range of 0.00 Volts to + 3.30 Volts (just like the one in the TM4C123G).
(a) What is the minimum voltage that an analog
input voltage could change and be guaranteed to be detected by a
change in the digital output value? E.g. in millivolts or
microvolts.
(b) What is the binary number that represents an
analog voltage of +1.11 volts?
(c) Suppose that the A/D converter is connected to
a microprocessor with a 16-bit wide data bus. What would the
hexadecimal number be for an analog voltage of +2.96V?
(d) Assume that the A/D converter is a successive
approximation-type A/D converter. How many samples must it take
before it finally digitizes the analog voltage?
(e) Suppose that the A/D converter is being
controlled by a 1 MHz clock signal and a sample occurs on the
rising edge of every clock. How long will it take to digitize an
analog voltage?
Thank you for the help! Much appreciated!
In: Electrical Engineering
How is a megger test performed on an XLPE cable? Like, to what parts are the megger terminals connected to? And what does each result indicate? Like what does 0 mean, and what does infinity mean? Please provide me with a simplified circuit of the connection between the megger and the cable.
In: Electrical Engineering
I am trying to plot a difficult function in MATLAB, however I need to understand the basics first.
I am trying to plot
n=0
for x=0:0.01:2pi
n=n+1
y(n)=sin(x)
end
I beleive what this says, is that I want to plot sin(x) over a full period hence from o to 2pi, and I beleive the 0.01 is the incremenation along the x-axis. I am not sure what my n is doing
Could smeone please graph this for me with the MATLAB code as well, and show was you were doing and what the functions and things mean for exaple what ":" means and so on
In: Electrical Engineering
In: Electrical Engineering
Is QPSK is not secured network?
Is QPSK shared?
In: Electrical Engineering
We have a controller, and every time the Operator changes the Set Point, the controller responds, and gets the process sorted out. Now, somewhere, we have read that load disturbances needed to be considered in processes, as well. How will this controller react, if there is a load disturbance, and not a Set Point change? provide a basic answer to this.
In: Electrical Engineering
In: Electrical Engineering
Using relevant diagrams, explain the operational of master-slave JK Flip-Flop.
In: Electrical Engineering
4.11)The equivalent circuit parameters of a 150 kVA, 2400 V/ 240 V, 60 Hz transformer are as follows:
RHV = 0.21Ω, RLV = 2mΩ, XlHV = 0.45Ω, XlLV = 4.6mΩ, XmHV = 1.6kΩ, and RcHV = 12kΩ.
The transformer delivers to a load, rated current at a power factor of 0.85 lagging at rated voltage. Determine the input voltage, current, apparent power and power factor, (a) using the approximate equivalent circuit, and (b) not using the approximate equivalent circuit.
Problem 4.12 For the transformer in problem (4.11), determine the efficiency when operating with, 1. rated current, rated voltage and lagging power factor of 0.8, 2. 80% of rated current, rated voltage, and unity power factor. Problem
4.13 Calculate the voltage regulation of the transformer in problem (4.11) when delivering,
1. rated current at 0.9 lagging power factor,
2. rated current at unity power factor, and
In: Electrical Engineering
Explain to me how a metal oxide semiconductors field effect transistor works, and how it is applicable to the wind industry. give detailed examples for full credit
In: Electrical Engineering
1. A sinusoidal voltage wave on a transmission line has real amplitude, V_0. The wave is expressed in phasor form as
V_s(z) = V_0*e^(-alpha*z)*e^(-j*(beta)*z)
a. In which direction does this wave propagate and why?
b. Express the given wave in real instantaneous form.
c. The parameters of the line, operating at ω= 6.0×10^8 rad/s are L = 0.350 μH/m, C = 40.0 pF/m, G = 0 and R = 15.0 Ω/m. Find α,β,λ, andZ_0 (in magnitude and phase).
d. Calculate the phase velocity of the wave, and find an expression for the time-average power in the line, as a function of distance, z , where V_0 = 13.7 V.
e. Find the distance from z = 0 over which the wave power is reduced by 10dB, and evaluate the power in mW at that location.
In: Electrical Engineering
Question 1: A Multiplexer (MUX)
a) Write truth table and draw symbol for a 4-to-1 MUX. (1 mark)
b) Write VHDL code for the above multiplexer. (1 mark)
c) Write VHDL code for a test bench and simulate the design. (1 mark)
d) Implement the design on FPGA, with inputs connected to switches and output to LED. (1 mark)
In: Electrical Engineering