Question

can anyone help me for describing how this cods work?? pleasssse help me

1.  close all;

2.  clear all;clc;

3.   

4.   t=1:0.025:5;

5.   desired=5*sin(2*3.*t);

6.   

7.   noise=5*sin(2*50*3.*t);

8.   

9.   refer=5*sin(2*50*3.*t+ 3/20);

10.  

11.  primary=desired+noise;

12.  

13.  subplot(4,1,1);

14.  plot(t,desired);

15.  ylabel('desired');

16.  

17.  

18. subplot(4,1,2);

19.  plot(t,refer);

20.  ylabel('refer');

21.  

22.  

23.  

24.  subplot(4,1,3);

25.  plot(t,primary);

26.  ylabel('primary');

27.  

28.   

29.  

30.  order= 2;

31.  mu=0.005;

32.  n=length(primary)

33.  delayed=zeros(1,order);

34.  adap=zeros(1,order);

35.  cancelled=zeros(1,n);

36.  

37.  for k=1:n,

38.      delayed(1)=refer(k);

39.      y=delayed*adap';

40.      cancelled(k)=primary(k)-y;

41.      adap = adap + 2*mu*cancelled(k) .* delayed;

42.      delayed(2:order)=delayed(1:order-1);

43.  end

44.  

45.  subplot(4,1,4);

46.  plot(t,cancelled);

47.  ylabel('cancelled');


0 0
Add a comment Improve this question Transcribed image text
Request Professional Answer

Request Answer!

We need at least 10 more requests to produce the answer.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
can anyone help me for describing how this cods work?? pleasssse help me
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • Hi I need help understanding this matlab code. Can you add comments or at least state what the lines in this code are doing. Thanks! close all; clear all;clc; t=1:0.025:5; desired=5*sin(2*3.*t); noi...

    Hi I need help understanding this matlab code. Can you add comments or at least state what the lines in this code are doing. Thanks! close all; clear all;clc; t=1:0.025:5; desired=5*sin(2*3.*t); noise=5*sin(2*50*3.*t); refer=5*sin(2*50*3.*t+ 3/20); primary=desired+noise; subplot(4,1,1); plot(t,desired); ylabel('desired'); subplot(4,1,2); plot(t,refer); ylabel('refer'); subplot(4,1,3); plot(t,primary); ylabel('primary'); order=2; mu=0.005; n=length(primary) delayed=zeros(1,order); adap=zeros(1,order); cancelled=zeros(1,n); for k=1:n, delayed(1)=refer(k); y=delayed*adap'; cancelled(k)=primary(k)-y; adap = adap + 2*mu*cancelled(k) .* delayed; delayed(2:order)=delayed(1:order-1); end subplot(4,1,4); plot(t,cancelled); ylabel('cancelled');

  • please help me with this MATLAB CODE and explain to me what each line does and...

    please help me with this MATLAB CODE and explain to me what each line does and what is used for? leave your comments as words, not as pictures. ..................................................................................................................................................................... clear all; close all; % For a script file, you better start with clear all and close all                        % However, for a fucntion, you better NOT to start                        % with them %% End of cell mode example %% Plot function t = 0:0.1:5; x1 = sin(2*5*t); x2 = cos(3*7*t);...

  • I need help in MATLAB. I'm working on a circuits lab report and I want to...

    I need help in MATLAB. I'm working on a circuits lab report and I want to plot the derivative of an input signal. The circuit is a differentiator OpAmp. It is receiving a triangle wave as an input and should output a square wave. (I've included my existing code.) The output formula is: Vout = -(Rf)*C*(dVin/dt) Where Rf is feedback resistance: Rf = 1*10^6; and C = 1*10^-6. EXISTING CODE: %% This section is copied, and then modified from another...

  • N MATLAB: This is an easy problem to demonstrate how polyfit and polyval work! The values...

    N MATLAB: This is an easy problem to demonstrate how polyfit and polyval work! The values in y are basically a sine function on x. You can validate by checking in MATLAB >> x = 0:9 x = 0 1 2 3 4 5 6 7 8 9 >> y = sin(x) y = 0 0.8415 0.9093 0.1411 -0.7568 -0.9589 -0.2794 0.6570 0.9894 0.4121 Now, let us try to see what happens if we use polyfit on the values of...

  • Can you please help me with this question. Much appreciated. So I have a sample code,...

    Can you please help me with this question. Much appreciated. So I have a sample code, but we need to change the code in a way that fits the problem. A planar slab of material is initially at a temperature of 300 K. At the time t=0, microwave radiation is directed at the material, leading to internal heat generation that is uniform within the material. The sides of the slab experience negligible heat losses and a water bath maintains the...

  • LMS project Using the notes discussed in class: Implementing the LMS Algorithm First generate some signals clear all c...

    LMS project Using the notes discussed in class: Implementing the LMS Algorithm First generate some signals clear all close al1: Generate signals for testing the LMS Algorithm 1000 Fs Sampling frequency Sample time 1/Fs 10000: = L Length of signal S Time vector (0:L-1) *T ; Sum of a 50 Hz sinusoid and a 120 Hz sinusoid 0.7 sin (2*pi*50*t); inuside X d+ 10 randn (size (t)); Sinusoids 5O0000000L plus noise fiqure (1) plot (Fs*t (1:150),x (1:1500)) title('Signal Corrupted with...

  • Please follow following scripts: Script for part A:Script for Part B: Matlab Exercises 1. Find the...

    Please follow following scripts: Script for part A:Script for Part B: Matlab Exercises 1. Find the determinant (command: det(A)) and the condition number (command: cond(A)) of the Hilbert matrix H of order k (command: hilb(k)), for k = 1,2, ..., 10. Plot the determinant and the condition number as a function of k using a logarithmic scale for the vertical axis. Hint: The template to help you with this homework assignment is homework/hw15.m. 2. Determine if y is in the...

  • LMS project Using the notes discussed in class: Implementing the LMS Algorithm First generate some signals...

    LMS project Using the notes discussed in class: Implementing the LMS Algorithm First generate some signals clear all close al1: Generate signals for testing the LMS Algorithm 1000 Fs Sampling frequency Sample time 1/Fs 10000: = L Length of signal S Time vector (0:L-1) *T ; Sum of a 50 Hz sinusoid and a 120 Hz sinusoid 0.7 sin (2*pi*50*t); inuside X d+ 10 randn (size (t)); Sinusoids 5O0000000L plus noise fiqure (1) plot (Fs*t (1:150),x (1:1500)) title('Signal Corrupted with...

  • How can I get my while loop to run until my condition in my if statement...

    How can I get my while loop to run until my condition in my if statement is met? (In MATLAB) clc%clears screen clear all%clears history close all%closes all files format long %Euler's Method %Initial conditions and setup %Projectile motion x=3;%randi(3); y=3;%randi(3); figure('color','white'); plot(x,y,'bo'); hold on wind = (-10 + 20*rand(1)); fprintf('The wind speed is %2.2i\n',wind); v0= input('Initial velocity(m/s): '); a= input('Angle of projection(in degrees): '); a=a*pi/180; h=.01; cd=.1; %cdy=.1; %cdx=(rand*2-1)/2; %cdy=(rand*2-1)/2; m=1.5; g=9.8; %acceleration due to gravity in m/s^2 %td=2*v0*sin(a)/g;...

  • CAN YOU PLEASE CHECK WHATS WRONG? function[F]=func(t,h) global Atank Ahole kOne kTwo g rho %F=zeros(2,1) %NL=y(1)...

    CAN YOU PLEASE CHECK WHATS WRONG? function[F]=func(t,h) global Atank Ahole kOne kTwo g rho %F=zeros(2,1) %NL=y(1) %NG=y(2) F=(kOne+kTwo*cos(2*pi*t/24)-rho*Ahole*sqrt(2*g*h))/(rho*Atank); close all clear all %clear all %close all global Atank Ahole kOne kTwo g rho Atank = 3.13;% Atank value Ahole =0.06; %Ahole value kOne = 300; % K1 value kTwo = 200; % K2 value g = 9.81; % Gravity rho = 1000; % rho value t0=0; tf=150; %range of time %Initial value h0_2=h(1); h0_1=h(2); h0_0=h(3); n=input('Enter the number of steps:');...

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