Question

MATLAB %% T = 1; N = 11; np = 2; dt = 0.001; tmax =...

MATLAB

%%
T = 1;
N = 11;
np = 2;

dt = 0.001;

tmax = np*T;
t = -tmax:dt:tmax;


%% Function 1
%the following code was used to create the x(t) function
xrange = floor((T/dt)/15);
x1 = linspace(0,1,xrange);
x2 = x1(end-1:-1:1);
x3 = linspace(0,2,2*xrange);
x4 = x3(end-1:-1:1);
x5 = zeros(1,xrange);
x6 = x1;
x7 = 2*ones(1,xrange);
x8 = 1+x2;
x9 = -0.5*ones(1,xrange);
x10 = x1/2-0.5;
xtemp = [x1 x2 x3 x4 x5 x6 x7 x8 x9 x10];
ztemp = zeros(1,floor(T/dt)-length(xtemp));

xtT = [ztemp xtemp];
tT = dt:dt:T;

xt = 0;
for nn = 1:np
xt = [xtT xt xtT];
end

plot(t,xt)
axis([-tmax tmax -1 3])
grid on
xlabel('Time(s)');

%%
% Determine ak coefficients for x(t)
% Plot the approximation of x(t) using ak coefficients for |k|<=11

%% function 2
% x2(t) = sin(4*pi*t) 0<t<1/2
% x2(t) = 0 1/2<t<1
% x2(t) = x2(t+1)

% Determine ak coefficients for x2(t)
% Plot the approximation of x2(t) using ak coefficients for |k|<=11

0 0
Add a comment Improve this question Transcribed image text
Answer #1

ANSWER:

Given that

Executable Code:

T = 1;
N = 11;
np = 2;
dt = 0.001;
tmax = np*T;
t = -tmax:dt:tmax;
%% Function 1
%the following code was used to create the x(t) function
xrange = floor((T/dt)/15);
x1 = linspace(0,1,xrange);
x2 = x1(end-1:-1:1);
x3 = linspace(0,2,2*xrange);
x4 = x3(end-1:-1:1);
x5 = zeros(1,xrange);
x6 = x1;
x7 = 2*ones(1,xrange);
x8 = 1+x2;
x9 = -0.5*ones(1,xrange);
x10 = x1/2-0.5;
xtemp = [x1 x2 x3 x4 x5 x6 x7 x8 x9 x10];
ztemp = zeros(1,floor(T/dt)-length(xtemp));
xtT = [ztemp xtemp];
tT = dt:dt:T;
xt = 0;
for nn = 1:np
xt = [xtT xt xtT];
end
plot(t,xt)
axis([-tmax tmax -1 3])
grid on
xlabel('Time(s)');
%%
% Determine ak coefficients for x(t)
% Plot the approximation of x(t) using ak coefficients for |k|<=11

%% function 2
% x2(t) = sin(4*pi*t) 0<t<1/2
% x2(t) = 0 1/2<t<1
% x2(t) = x2(t+1)

% Determine ak coefficients for x2(t)
% Plot the approximation of x2(t) using ak coefficients for |k|<=11

Expected output:

Add a comment
Know the answer?
Add Answer to:
MATLAB %% T = 1; N = 11; np = 2; dt = 0.001; tmax =...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Now, let’s assume that the distribution of codons is not uniformly random. We also assume that...

    Now, let’s assume that the distribution of codons is not uniformly random. We also assume that only 5 codons {C1,C2,C3,C4,C5} appear in a dataset with a set of 10 of observations of codon {X1=C2, X2=C1, X3=C1, X4=C4, X5=C1, X6=C3, X7=C5, X8 =C2, X9=C4, X10=C3}. Compute the probability distribution of the five codons. If C2 is a start codon and C3 is a stop codon, with the distribution you just computed, what is the probability that a start codon (C2) is...

  • Insulated x1 x 2 x 3 x4 x5 x 6 x7 x8 x9 x10 x1 x12 x13 x14 x15 x16 x17 x18 x19 x20 x21 x22 x23 x2...

    Could someone help me to solve this problem? Please explain the steps Insulated x1 x 2 x 3 x4 x5 x 6 x7 x8 x9 x10 x1 x12 x13 x14 x15 x16 x17 x18 x19 x20 x21 x22 x23 x24 x25 T 30 ← |T-50C h- 500 W/m2 C T-20 C 1. 2. Write the Finite Volume equation for node 23. [3 points] Write the 23"d line of the coefficient matrix and the right hand side [2 points] [ k-200...

  • Let X denote the proportion of allotted time that a randomly selected student spends working on...

    Let X denote the proportion of allotted time that a randomly selected student spends working on a certain aptitude test. Suppose the pdf of X is otherwise where-1くθ. A random sample of ten students yields data X1 = 0.49, x2-0.94, x3-0.92, X1 0.90, x8-0.65, x9 = 0.77, x10 = 0.97. 0.79, x5-0.86, x6-0.73, x7 = (a) Use the method of moments to obtain an estimator of θ 1 + X 1 + X (1-%)2 Compute the estimate for this data....

  • Let X denote the proportion of allotted time that a randomly selected student spends working on...

    Let X denote the proportion of allotted time that a randomly selected student spends working on a certain aptitude test. Suppose the pdf of X is otherwise where-1くθ. A random sample of ten students yields data X1 = 0.49, x2-0.94, x3 = 0.92, xa 0.90, x8-0.65, x9 = 0.77, x10 = 0.97. 0.79, x5-0.86, x6-0.73, x7 = (a) Use the method of moments to obtain an estimator of θ 1 + X 1 + X (1-%)2 Compute the estimate for...

  • Find the DTFT a. x1[n]=(.3)^nµ[n] b. x2[n]=(.3)µ[n-1] c. x3[n]=(.3)^n(µ[n]-µ[n-10]) d. x4[n]=(.3)^n(µ[n-1]-µ[n-10]) e. x5[n]=δ[n] f. x6[n]=δ[n-1] g....

    Find the DTFT a. x1[n]=(.3)^nµ[n] b. x2[n]=(.3)µ[n-1] c. x3[n]=(.3)^n(µ[n]-µ[n-10]) d. x4[n]=(.3)^n(µ[n-1]-µ[n-10]) e. x5[n]=δ[n] f. x6[n]=δ[n-1] g. x7[n]=δ[n]+3δ[n-1]+7δ[n-3]

  • identify the leading and lagging measures, find the correlation matrix, and purpose a cause and effect...

    identify the leading and lagging measures, find the correlation matrix, and purpose a cause and effect model using the strongest correlations Myatt Steak House 2010 2011 2012 2013 2014 Order Accuracy X1 86.0% 86.0% 89.0% 90.0% 95.0% Timeliness of Delivery X2 84.0% 82.0% 86.0% 93.0% 95.0% Table Cleanliness X3 4.8 4.8 5.1 5.6 5.8 Customer Satisfication X4 93.4% 93.2% 94.2% 95.3% 96.7% Total # Complaints X5 492 467 431 326 310 Customer Referrals X6 6 12 24 48 96 Gross...

  • Consider the high temperature diffusion of Arsenic at 1619°C for 290 hours into a semi-infinite solid...

    Consider the high temperature diffusion of Arsenic at 1619°C for 290 hours into a semi-infinite solid cylinder of pure silicon having a radius R=810 E-6 m. Assume values of Do = 0.218 cm2/s, Q = 332.2 kJ/mole, R = 8.314 J/mole-K and a surface concentration 6E18 atoms/cm3. Determine the concentration at the ten (10) equally spaced distances from the surface listed below. a)         Cx(@x0=0.0∙R) = Cx0=   ___6E+18_________ C@surface                  b)         Cx(@x1=0.1∙R) = Cx1=   _________________ c)         Cx(@x2=0.2∙R) = Cx2=  ...

  • MATLAB code starts here --------- clear T0=2; w0=2*pi/T0; f0=1/T0; Tmax=4; Nmax=15; %--- i=1; for t=-Tmax: .01:Tmax...

    MATLAB code starts here --------- clear T0=2; w0=2*pi/T0; f0=1/T0; Tmax=4; Nmax=15; %--- i=1; for t=-Tmax: .01:Tmax T(i)=t; if t>=(T0/2) while (t>T0/2) t=t-T0; end elseif t<=-(T0/2) while (t<=-T0/2) t=t+T0; end end if abs(t)<=(T0/4) y(i)=1; else y(i)=0; end i=i+1; end plot(T,y),grid, xlabel('Time (sec)'); title('y(t) square wave'); shg disp('Hit return..'); pause %--- a0=1/2; F(1)=0; %dc freq C(1)=a0; for n=1:Nmax a(n)=(2/(n*pi))*sin((n*pi)/2); b(n)=0; C(n+1)=sqrt(a(n)^2+b(n)^2); F(n+1)=n*f0; end stem(F,abs,(C)), grid, title(['Line Spectrum: Harmonics = ' num2str(Nmax)]); xlabel('Freq(Hz)'), ylabel('Cn'), shg disp('Hit return...'); pause %--- yest=a0*ones(1,length(T)); for n=1:Nmax yest=yest+a(n)*cos(2*n*pi*T/T0)+b(n)*sin(2*n*pi*T/T0);...

  • Python 1 import matplotlib.pyplot as plt 2 import numpy as np 3 4 abscissa = np.arange(20) 5 plt....

    python 1 import matplotlib.pyplot as plt 2 import numpy as np 3 4 abscissa = np.arange(20) 5 plt.gca().set_prop_cycle( ’ color ’ , [ ’ red ’ , ’ green ’ , ’ blue ’ , ’ black ’ ]) 6 7 class MyLine: 8 9 def __init__(self, * args, ** options): 10 #TO DO: IMPLEMENT FUNCTION 11 pass 12 13 def draw(self): 14 plt.plot(abscissa,self.line(abscissa)) 15 16 def get_line(self): 17 return "y = {0:.2f}x + {1:.2f}".format(self.slope, self.intercept) 18 19 def __str__(self):...

  • Problem 3: Question 2 in Section 6.7 (pg. 215) in the textbook A Modern Approach to Regression wi...

    Please explain this question in detail. Problem 3: Question 2 in Section 6.7 (pg. 215) in the textbook A Modern Approach to Regression with R. Chapter 5-2 of the award-winning book on baseball (Keri, 2006) makes extensive use of multiple linear regression. For example, since the "30 Major League Baseball teams play eighty-one home games during the regular season and receive the largest share of their income from the ticket sales associated with these games", the author develops a linear...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT