% Define the parameters frequency = 10; % Frequency in Hertz amplitude = 1; % Amplitude of the sine wave phase = 0; % Phase shift in radians samplingRate = 8000; % Sampling rate in samples per second duration = 0.25; % Duration of the signal in seconds % Create the time vector t = 0:1/samplingRate:duration; % Generate the sine wave y = amplitude * sin(2 * pi * frequency * t + phase); % Plot the sine wave plot(t, y); xlabel('Time (s)'); ylabel('Amplitude'); title('Sine Wave'); % Define the parameters frequency = 10; % Frequency in Hertz amplitude = 1; % Amplitude of the cosine wave phase = 0; % Phase shift in radians samplingRate = 8000; % Sampling rate in samples per second duration = 0.25; % Duration of the signal in seconds % Create the time vector t = 0:1/samplingRate:duration; % Generate the cosine wave y = amplitude * cos(2 * pi * frequency * t + phase); % Plot the cosine wave plot(t, y); xlabel('Time (s)'); ylabel('Amplitude'); title('Cosine Wave'); % Define the parameters frequency = 10; % Frequency in Hertz amplitude = 1; % Amplitude of the waves phase = 0; % Phase shift in radians samplingRate = 8000; % Sampling rate in samples per second duration = 0.25; % Duration of the signal in seconds % Create the time vector t = 0:1/samplingRate:duration; % Generate the sine and cosine waves y_sin = amplitude * sin(2 * pi * frequency * t + phase); y_cos = amplitude * cos(2 * pi * frequency * t + phase); % Plot the sine wave in red plot(t, y_sin, 'r'); hold on; % This command holds the current plot % Plot the cosine wave in black plot(t, y_cos, 'b'); hold off; % This command releases the current plot % Add labels and title xlabel('Time (s)'); ylabel('Amplitude'); title('Sine and Cosine Waves'); legend('Sine Wave', 'Cosine Wave'); % Add a legend