# programming

## Signals and communication Homework 2(8 problems)

Given the analog signal, sampled at the rate of 8000Hz (𝑡) = 3 𝑐𝑜𝑠( 2𝜋 × 1500𝑡) + 2 𝑐𝑜𝑠( 2𝜋 × 4200𝑡) t ≥ 0 Sketch the spectrum of the sampled signal up to 20 KHz Unsampled signal spectrum is; X(jw) —————————–(3/2)————————————- ——————————1————————————— -4.2 -1.5 1.5 4.2 kHZ Sampled signal spectrum is; X(jw) ——————————————————(3/2)——————————————————— —————————————————–1————————————————————– -17.5 -16.0 -14.5 -12.4 -11.8 -9.5 -6.5 -3.8 3.8 6.5 9.5 11.8 12.4 14.5 16.0 17 khz frequency In the above spectrum, there is an overlap. (b) Sketch the recovered analog signal spectrum if an ideal low pass filter with cutoff frequency of 4KHz is used to filter the sampled signal in order to recover the original signal. X(jw) khz frequency -3.8 +3.8 2. Assuming that a 5 bit ADC channel accepts analog input ranging from 0 to 4 volts , determine the following Number of quantization levels Levels=25=32 Quantization step size Step size Quantization output level when the analog signal is 1.2 volts =20th level Binary code produced by the ADC in this case (1.2 volts input). Binary code for decimal 20 is 10100 3. MATLAB Project: Given a signal waveform (𝑡) = 3.25 𝑠𝑖𝑛( 2𝜋 × 50𝑡) + 1.25 𝑐𝑜𝑠( 2𝜋 × 100𝑡 + 𝜋/4) Sample it at 8000 samples per second and (a) Write a MATLAB program to quantize x(t) using 6 bit bipolar quantizer to obtain the Quantized signal xq, assuming the signal range is from -5 to 5. The function below performs signal quantization decoding. Here X-min will be -5 and X-max will be +5. The function is named decodingquant and is added to the path of the software. It will be called in the main program. The bits will be 6 bits since we are using a 6 bit bipolar quantizer. function deout = decodingquant(bits,Xmin,Xmax,I) le=2*bits; delta=(Xmax-Xmin)/le; deout=Xmin+I*delta; %the following function performs signal quantization decoding. This is a code for a function named quantization that performs signal quantization: function [I, out] = quantization(bits,Xmin,Xmax, value) le=2*bits; delta=(Xmax-Xmin)/le; I=round((value-Xmin)/delta); if I==le I=I-1; end if I<0 I=0; end out=Xmin+I*delta; The main program: This is where we will call our functions: quantization decodingquant We also initialize and write the code. This program quantizes the signal using 6-bits bipolar quantizer to obtain the to obtain the quantized signal x_q and plots the original and quantized signal. clc clear close all Tm=1/50; %Time period of the signal fs=8000; %This is the samplig frequency T=1/fs; %The sampling time period t=0:T:2*Tm; %This the the two period-time array. signal=3.25*sin(2*pi*50*t)+1.25*co bits=6; %6 bit quantizer as asked in the question. l=length(signal); ter initializing everything, we carry out quantization Index=zeros; quadsignal=zeros; for x=1:l [Index(x), qout]=quantization(bits,-5,5,signal(x)); end % we call the function inprder to recover signal from quantized values. % also indicate the signal range:from -5 to 5. for x=1:l quadsignal(x)=decodingquant(bits,-5,5,Index(x)); end plot(t,signal,'b') hold on stairs(t,quadsignal,'r'); ylabel('Signal') % xlabel('time (s)') legend('Original ','Quantized ') %Inorder to plot original signal and quantised signal. hold off

## Java

/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package test.program; import java.util.*; /** * Distinct elements in ArrayList. * Write the following method that returns a new ArrayList. * The new list contains the non-duplicate elements from the original list. * * public static ArrayList removeDuplicates(ArrayList list) * */ public class TestProgram { public static ArrayList removeDuplicates(ArrayList list) { //making empty ArrayList ArrayList out=new ArrayList(); //frame into list for(int i=0;i<list.size();i++) { //confirm alreay present in ArrayList or not if(!out.contains(list.get(i))) { // if not present then add it out.add(list.get(i)); } } // then return list return out; } public static void main(String[] args) { //prepare an object Random r=new Random(); ArrayList arr=new ArrayList(); System.out.println(“Input ArrayList:”); //have a loop for(int i=0;i<50;i++) { //create and produce number in ArrayList arr.add(r.nextInt(20)+1); System.out.print(arr.get(i)+" "); } //call function and store output ArrayList out=removeDuplicates(arr); //produce output System.out.println(“nOutput ArrayList:”); for(int i=0;i<out.size();i++) { System.out.print(out.get(i)+" "); } } }

## Solved Free : COSC2436 – FA LAB5 – Data Structure : Generic Binary Search Tree BST and Generic

COSC2436 – FA LAB5 – Data Structure: Generic Binary Search Tree BST and Generic AVLTree Demo TITLE: – COSC2436 – FA LAB5 – Data Structure: Generic Binary Search Tree BST and Generic AVLTree Demo Read input file, Write to file – Data Structure: Generic Binary Search Tree BST and Generic AVLTree Demo Time to complete: …

## Java II Mid-Term – Consider the hierarchy of classes shown below.

A subclass of Value, LargerValue, is defined with a getValue method that returns twice the value of the parent. Which line is the body of LargerValue’s getValue method?

## Laboratory 1 Assembly Language and the RISC-V ISA

The RISC-V Assembler and Runtime Simulator (RARS) can be downloaded from: https://github.com/TheThirdOne/rars/releases/tag/v1.5 All information is in pdf file   DOWNLOAD FILES HERE Laboratory 1 Assembly Language and the RISC-V ISA Page 1of 6School of EngineeringEEET2261–Computer Architecture and OrganisationLaboratory 1Assembly Language and the RISC-V ISA1Aims(i)To develop an appreciation for the abstraction provided by a microprocessor’s Instruction …

## Web Service Project You are to develop – A currency converter XML web service

Web Service Project You are to develop: A currency converter XML web service A web service client requesting the currency converter XML web service The Currency Converter XML Web Service Create an ASP.net project named “WebServiceFall2019” (empty and non-HTTPS) Add a New Item: Web Service (ASMX) named CurrencyConvert.asmx Add the CurrencyConvert web service:<WebMethod()> Public Function …

## CPSC165 – Introduction to Internet Concepts and Web Design principles

CPSC165 – Introduction to Internet Concepts and Web Design principles Spring 2020 Final Project: Build a moderate-size Web Site Submission due: Friday, June 26, 2020 (11:59pm)   Project Description   In this project you will build a moderate-size Web site. The theme of the Web site is decided by the members of your project group. …

Sample Post

## Chapter 1: Introduction to Economy

Ch01 Introduction-to-Economy Multiple Choice Questions 1. In countries like _____________ the command economy predominates. A. China and Vietnam B. Cuba and North Korea C. South Africa and Kenya D. Germany and France Answer: B  Reference: Explanation: 2. In which of the following countries will the national government have the greatest influence with respect to the …

## Forecasting Chicken Wing Demand

Exercise 1: Forecasting chicken wing demand The following data represents the weekly demand for chicken wings at a local restaurant during the past six weeks: Week 1 2 3 4 5 6 Demand 650 521 563 735 514 596 Complete the following: a.    Forecast the demand for week 7 using a five-period Moving average. b.    Forecast …