Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Matlab 6 Synthesize the sound piano eo 130.5 Fundamental frequency / Hz 67 68 69

ID: 3594548 • Letter: M

Question

Matlab 6 Synthesize the sound piano eo 130.5 Fundamental frequency / Hz 67 68 69 70 71-Ts2 72-NS20 73 - 74- len-1s* fss;% length (Ys) 75- deltaf fs/len; 76-n peak 0/delta f+l: 2.2.1 Synthesize a signal that will define frequency resolution (all components same phase) duration in s number of components sampling frequency in Hz tss . 44100: - - - % distance between two samples - - % number of samples between to peaks create a vector rs ( ynthe sized) containing complex spectrum of a 5um of sinusoids 79 80Yzeros (len, 1) 81- y-pos-zeros (fix( 82 83 94 85 ) +1,1); % here we divide the NYQUIST freq by the spectral resolution and see i (fs-s/2) /delta-f % positive half (freq) of t vector we have a sample there (fix). for loop to fill in the peaks for the positive frequencies or n-L:N 20 peaks on the positive frequencies amplitude of peaks 87- 88-end 89 90 91 92 93 94 95 % check if vector is even or odd. If it is even, it will hiot the NYQUIST frequency, then the spectrum is mirrored around this - and hence it is % NOT contained in the negative frequencies. If it is odd, the NYQUIST frequency will NOT be hit, hence you have a sample symetrically around the NYQUIST frequency and need to take all but the first sample of the % positive frequencies (the DC) with you:

Explanation / Answer

Sport.java //Base class

public class Sport{
public String sportName;
public int noOfPlayers;
public Sport(String name, int pl){
sportName = name;
noOfPlayers = pl;
}
public void displayMessage(){
System.out.println("Sport name is " + sportName);
System.out.println("Number of players who play this sport " + noOfPlayers);
}
}

Football.java

public class Football extends Sport{

public Football(String name, int pl){
super(name, pl);
}
public void displayMessage(){
System.out.println("Sport name is " + sportName);
System.out.println("Number of players who play this sport " + noOfPlayers);
System.out.println("Rest of the world calls this sport American Soccer");
System.out.println("--------------------------------------");
}
}

Tennis.java

public class Tennis extends Sport{
public String device;

public Tennis(String name, int pl, String dev){
super(name, pl);
this.device = dev;
}
public void displayMessage(){
System.out.println("Sport name is " + sportName);
System.out.println("Number of players who play this sport " + noOfPlayers);
System.out.println("Tennis is of 2 types : Table tennis and Lawn Tennis");
System.out.println("Tennis is played with a " + device);
System.out.println("--------------------------------------");
}
}

Basketball.java

public class Basketball extends Sport{
public String device;

public Basketball(String name, int pl, String dev){
super(name, pl);
this.device = dev;
}
public void displayMessage(){
System.out.println("Sport name is " + sportName);
System.out.println("Number of players who play this sport " + noOfPlayers);
System.out.println("Basketball is played with a " + device);
System.out.println("Basketball players are very tall");
System.out.println("--------------------------------------");
}
}

Baseball.java

public class Baseball extends Sport{
public String device;

public Baseball(String name, int pl, String dev){
super(name, pl);
this.device = dev;
}
public void displayMessage(){
System.out.println("Sport name is " + sportName);
System.out.println("Number of players who play this sport " + noOfPlayers);
System.out.println("Basketball is played with a " + device);
System.out.println("Baseball pitcher throws the ball very fast");
System.out.println("--------------------------------------");
}
}

SportDriver.java //Driver class to test all above classes

public class SportDriver{
public static void main(String []args){
Sport s1, s2, s3, s4;
s1 = new Football("Football", 11);
s2 = new Tennis("Tennis",2, "racquet");
s3 = new Basketball("Basketball", 5, "basket-ball");
s4 = new Baseball("Baseball", 9, "baseball bat");
s1.displayMessage();
s2.displayMessage();
s3.displayMessage();
s4.displayMessage();
}
}