Consider the following MATLAB code: N = 200; y = zeros(1,N); for i=1:3 sinu(i).freq=0.15*i; sinu(i).amp = 2*i; sinu(i).phs = pi/4; for k=1:N X(i,k) = sinu(i).amp*cos(2*pi*sinu(i).freq*(k-1) + sinu(i).phs); end y = y +X(i,:); end stem([0:N-1],y) xlabel('n') Enter the value in the figure generated by the code corresponding to n = 0. Points possible: 1 Allowed attempts: 3 Retry penalty: 33.333% Enter the value of X(2,3). Points possible: 1 Allowed attempts: 3 Retry penalty: 33.333%
Added by Eric E.
Close
Step 1
Step 1: Consider the given information and identify any relevant equations or concepts. Show more…
Show all steps
Your feedback will help us improve your experience
Sri K and 80 other Physics 102 Electricity and Magnetism educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
The following (incomplete) code in Matlab was proposed to use the bisection method in order to compute a root of the equation tan x - x = 0. % The bisection algorithm for finding % a root of the equation tan(x)-x=0. f=inline('tan(x)-x'); a=4.3; b=4.6; iter=0; if f(a)*f(b)>0 error( 'f(a) and f(b) do not have opposite signs' ) else p = (a + b)/2; err = abs(f(p)); while err > 0.01 if f(a)*f(p)<0 .....; else .....; end iter=iter+1; .....; err = abs(f(p)); end end (a) Fill in the lines indicated by the arrows in order to complete the above code. Note: You are NOT allowed to change or remove any other lines of the code. (b) How many iterations are needed for the above accuracy? (c) What is the approximation of the root of tan x - x = 0 computed by the above (completed) code?
Sri K.
The initial value problem y' = dy/dx = x^2 cos(xy), y(1) = 2 is to be solved on the interval x ∈ [1, 3] using the forward Euler method with step h = 0.05 How many steps of the method must be taken to obtain the solution at x = 3? Determine the value of the approximate solution at x = 3. Round correct to the fourth decimal place y(3) = (Hint: By default Matlab rounds the answer to the fourth decimal place). The initial value problem [dx/dt; dy/dt] = [0, 1; -1, -2][x; y], x(0) = 1, y(0) = 2 is to be solved on the interval t ∈ [0, 5] using the backward Euler method with step h = 0.1 The iteration update rule for the method is [x_{n+1}; y_{n+1}] = (I - hA)^{-1} [x_n; y_n], where I is a 2 x 2 identity matrix. Determine the approximate values of x(5) = (round to the fourth decimal place) and y(5) = (round to the fourth decimal place). Now use the Matlab solver ode45 to obtain the solution at t = 5: x(5) = (round to the fourth decimal place) and y(5) = (round to the fourth decimal place).
y(n) = u(n) * sum(alpha^k from k=0 to n) = (1-alpha^(n+1))/(1-alpha) * u(n) When n -> infinity, y(n) = 1/(1-alpha) y(n) = x(n) * h(n) = sum(x(k)h(n-k) from k=-infinity to infinity) = sum(alpha^k u(n-k)u(k) from k=-infinity to infinity) = sum(alpha^k from k=0 to n) = (1-alpha^(n+1))/(1-alpha) * u(n) When length for Matlab simulation is 10 clc; clear; m = 10; x = zeros(1, m); for i = 1 : m x(i) = 1; end n = 10; h = zeros(1, n); alpha = 0.6; for i = 1 : n h(i) = alpha ^ (i-1); end X = [x, zeros(1, n)]; H = [h, zeros(1, m)]; for i = 1 : n+m-1 Y(i) = 0; for j = 1 : m if(i-j+1 > 0) Y(i) = Y(i) + x(j) * H(i-j+1); end end end % Y = conv(x, h); num = 0 : n+m-2; stem(num, Y); ylabel('Y[n]'); xlabel('----->n'); title('Convolution of Two Signals without conv function'); When length for Matlab simulation is 20
Recommended Textbooks
University Physics with Modern Physics
Physics: Principles with Applications
Fundamentals of Physics
Transcript
Watch the video solution with this free unlock.
EMAIL
PASSWORD