% 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
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}