clc clear close all % Problem 2-19 % Text Book(s): Electronic Communications: Principles and Systems % Calculating the coefficients equations A_0, A_n and B_n syms t n; A = 0.004; T = 0.01; f1 = 1/T; w=2*pi*f1; A_0 = 0; A_n = (2/T)*(((int(t*cos(w*n*t),t,0,0.004)))+((int((-4*t+0.020)*cos(w*n*t),t,0.004,0.005)))+((int((-1*t+0.005)*cos(w*n*t),t,0.005,0.009)))+((int((4*t-0.04)*cos(w*n*t),t,0.009,0.01)))); B_n = (2/T)*(((int(t*sin(w*n*t),t,0,0.004)))+((int((-4*t+0.020)*sin(w*n*t),t,0.004,0.005)))+((int((-1*t+0.005)*sin(w*n*t),t,0.005,0.009)))+((int((4*t-0.04)*sin(w*n*t),t,0.009,0.01)))); %% % Calculating the series coefficients n = 1:N N = 50; for n = 1 : N An(n) = eval(A_n); Bn(n) = eval(B_n); end subplot(4,1,1); stem(1:N,An); hold;grid; stem(1:N,Bn,'r'); stem(0,A_0,'c');hold off % The Fourier Series % for n = 1 : N Fun(n) = An(n)*cos((w*n)*t)+Bn(n)*sin((w*n)*t); end FunS = A_0 + sum(Fun); t = -2*T : T/100 : 2*T; subplot(4,1,2); plot(t,eval(FunS)); grid %Attempt at Fourier transform y=fft(eval(FunS)); subplot(4,1,3); plot(t,y); grid subplot(4,1,4); plot(t,real(y),t,imag(y)); grid % Define the number of quantization levels (bits) N_bits = 8; % You can adjust this value to your needs % Calculate the range for each quantization level max_value = max(eval(FunS)); min_value = min(eval(FunS)); range = max_value - min_value; % Calculate the step size step_size = range*2 / (2^N_bits); % Quantize the signal quantized_signal = round((FunS - min_value) / step_size) * step_size + min_value; % Plot the quantized signal figure; subplot(2,1,1); stem(t, eval(quantized_signal)); xlim([-0.01, 0.01]); grid; title('Quantized Signal'); % Plot the original signal for comparison subplot(2,1,2); plot(t, eval(FunS)); xlim([-0.01, 0.01]); grid; title('Original Signal');
Step by stepSolved in 4 steps with 6 images
- ( 100110 )2 = ( ? ? Joray %3Darrow_forwardHandwork problem (also includes MATLAB applications): HW10_1 First, compute the integral analytically. Then estimate the integral to 6 decimal places, as instructed. a) handwork Use multiple applications of the trapezoid rule, with n=6. .3 dx b) handwork Apply the composite trapezoid rule, with n=6. (3x + 1)3 c) MATLAB Apply the composite trapezoid rule, with n=6, 12 & 24 d) handwork Use multiple applications of Simpson's 1/3 rule, with n=6. e) handwork Apply the composite Simpson's 1/3 rule, with n=6. f) MATLAB Apply the composite Simpson's 1/3 rule, with n= 6, 12 & 24 for all cases, handwork & MATLAB: Compare all results with the exact integral, and compute the relative errors using MATLAB and publish as pdf.arrow_forwardF(A,B,C, D,E) =E ml0,1;3,6,8,9,14,ky1319,25,2931) DE 61 10 60 00 61 10arrow_forward
- Question 5 Numerical Approximation Methods basic ideas: Please write the basic idea (with key equations), application example, advantages and limitations of the following numerical approximation methods for solving linear/nonlinear equations. Please also state cases/examples for which one method can provide good result, but other may not. 1) Relaxation method 2) Binary search method 3) Newton's method 4) Secant method [Note: You can use simple examples for showing their applications. You might not need to derive any method]arrow_forwardComputer Science AI questionarrow_forwardODU2MTQ4/a/MjkwNjEwMTAyODU1/details Problem: 1 A company want to raise the salary of its employee. The raise rate is given as following: The raise rate is 20% of the salary if the employee have 15 years in work or more The raise rate is 10% of the salary if the employee have 7 years in work or more Otherwise, the raise rate is 5% of the salary. The new salary is computed by the formula: new salary=old salary x(1+ raise rate) Write a main program that prompts the user to enter n of employees then enter their salary and years in work of each of them. It displays the new salary for each employee and finally, it displays the average salaries of all employees after raising as shown in the following sample run. Sample run Enter the number of employees: 2 Enter the salary and the number of years of Employee 1: 1500 Enter the salary and the number of years of Employee 2. 800 16 8. The New Salary of Employee 1 is: 1800 The New Salary of Employee 2 is: 880 The average Salary of all employees is:…arrow_forward
- EXPLAIN LINE BY LINE THIS ARDUINO CODE Please explain each and every line in detail Simple Cylon Cylon Eye sweep using 5 LEDs */ unsigned char upDown=1; unsigned char cylon=0; void setup() { DDRB = B00011111; } void loop() { if(upDown==1){ cylon++; if(cylon>=4) upDown=0; } else { cylon--; if(cylon==0) upDown=1; } PORTB = 1 << cylon; delay(150); }arrow_forwardQUESTION 22 Multiple Choice: Which java statement correctly processes an array variable ? O while (x < arr.length){ int value = arr[x]; x++; } %3D for(int x = 0; x < arr.length; x++){ int value = arr[x]; } %3D process(arr); do { int value = arr[x]; x++; } %3D while (x < arr.length); QUESTION 23 True or False: An array is a basic data type. O True Falsearrow_forwardWhat input or parameter value impacts the number of times the recursive function will be called. • Give three specific examples of input/parameter values and, for each, state the number of times the recursive function will be called. • Devise a formula with respect to n that describes the number of times the recursive function will be called, where n is either the value passed or some property of the value passed (e.g. n might be the length of a string of the size of an array).arrow_forward
- using System; class HelloWorld { static void Main() { int rows=21; int columns=76; for(int i=0;i<rows;i++) //for loop for printing the pattern for 21 rows { for(int j=1;j<=columns;j++) //for loop for printing the pattern in 76 columns { if((i+j)%7!=1 ) //if the addition of i and j does not give remainder of 1 when divided by 7 then Console.Write("-"); //print dash - on console else //otherwise peint a space on console Console.Write(" "); } Console.WriteLine(); //print a newline for printing on new row... } } }arrow_forwardQuestion 11 mah.calculate any 4 by 4 matrix (java)arrow_forwardMatlab programmingarrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education