Write a code in matlab for AWGN () function. (please comment each line of the code to know what each line does)
f u n c ti o n [y,n] = add_awgn_noise(x,SNR_dB)
%[y,n]=awgn_noise(x,SNR) adds AWGN noise vector to signal ’x’ to
generate a
%resulting signal vector y of specified SNR in dB. It also returns
the
%noise vector ’n’ that is added to the signal x
L=l e n g t h(x);
SNR = 10ˆ(SNR_dB/10); %SNR to linear scale
Esym=sum(abs(x).ˆ2)/(L); %Calculate actual symbol energy
N0=Esym/SNR; %Find the noise spectral density
i f ( i s r e a l (x)),
noiseSigma = s q r t(N0);%Standard deviation for AWGN Noise when x
is real
n = noiseSigma*randn(1,L);%computed noise
e l s e
noiseSigma=s q r t(N0/2);%Standard deviation for AWGN Noise when x
is complex
n = noiseSigma*(randn(1,L)+1i*randn(1,L));%computed noise
end
y = x + n; %received signal
end
Write a code in matlab for AWGN () function. (please comment each line of the code...
Please use MatLab and comment code.
Problem 2 Write a MATI AB user-defined function y-M?SotxType): x is a vector containing numbers. and Type can be 'Ascending' or Descending'. This function should sort the given vector x in the ascending or descending order based on the user's request and return the desired vector as the output. Do not use MATLAB built-in function sort. Hint: When you call this function you need to use for Ascending or Descending since they are strings.
Please I need help with MATLAB .. PLease help me . Thankyou Write Matlab code to plot a 2D sinc function over a 2D cartesian grid where x ranges from 100 to 355 and y ranges from 0 to 255 and the sinc is centered at somewhere not midway in the grid. First plot the grid, and then plot the function on the grid (both as grayscale and as a surface plot). Comment the code well, generate the figures and...
Consider the function f(x) = x3 – 2x2 + x Write the MATLAB code in the format of "script file" using "Regula Falsi Method" with the estimated relative error of 0.000001 and upload the script file. Direction: 1) Please submit"script file", NOT "function file". If you submit a function file, I will assign ZERO score. 2) You can find some matlab code for the Regula Falsi Method on a web or some books. You can use any code you can...
Part a: Write a Matlab code that generate Exponential Function. Part b Write a Matlab code that generate sinusoidal Function. Part c Write a Matlab code that generate Unit Ramp delay (shift) function
Q: please solve using matlab code withe comment 1. Write the Matlab code to generate: x = cos(w1*t) + cos(w2*t); where, w1=7; w2=23; t = [0:0.005:2] 2. Plot the signal using sub plot a. in time domain b. in frequency domain 3) Sample the signal under different sampling conditions: a. Ts<1/2fm b. Ts=1/2fm c. Ts>1/2fm 4). Multiple plot: the signal sampled under sampling condition and the signal x a. in time domain b. in frequency domain c. Label and Title...
C Language! Please, comment what each line of code does in the code below and answer this question: (sentence is fine) 1. Aside from pressing ctrl-(d/z) at the beginning of a line causing the getnchar() function to return NULL, is there any way to enter less than 9 characters? Code: void exer1(void) { char input[LEN]; char *check; getchar(); // Clearing character buffer. printf("Please enter 9 characters: "); // Prompting the user to enter // a specific input. ...
#Practical Quiz 3 #Add a comment above each line of code describing what it does. #Be specific. Use multiple comment lines if you need to #OR write code below the comments requesting code. #Make sure your file runs and generates the correct results. def main(): #define variable str1 with string "Hello" str1 = "Hello" #print out the 2nd letter print(str1[1]) #START QUIZ HERE print(str1[-2]) print(str1[:3]) print(str1[2:len(str1)-1]) str2 = "World" print(str1+str2) #write code below to iterate over the str1 and print...
** Please provide a code in MATLAB ** 1. Write a function called taxcalculator that reads an amount in dollars, adds tax based on the table below and return the total with tax using elseif statement. 2. Write a function called printstars that reads the number of rows and returns a triangle of stars similar to the one below: * ** *** **** ***** ****** ******* ********
photo of the code please and an explnation if possible,
Construct a simple MATLAB function program my_factorial which calculates product of first n positive integer numbers (i.e. find factorial n!). For full points: - Make sure you protect the code from illogical use (n must be positive integer) - Test the function by comparing with built in MATLAB function factorial(n) - Make sure you test your function for any limitations. O marks) -3. Using my factorial function from the previous...
write a matlab code
Write a MATLAB function to check the stability of a digital filter described by its coefficients. Syntax: stable (b, a); where b and a are the system's forward and backward coefficient. Hint: The roots() function might be useful. Returned value: None. Operation: Displays either 'Stable' or 'Not Stable' message and plots the z-plane. Test with Case#1: y(n)= 2x (n) +x (n-1) +0.4y (n-1) - 0.6y (n-2) Case#2: y(n)= x(n) +0.5x (n-1) +2x (n-2)- y(n-1) +y (n-2)...