Mudanças entre as edições de "Teste do highlight de códigos"

De MediaWiki do Campus São José
Ir para navegação Ir para pesquisar
Linha 8: Linha 8:
 
else:
 
else:
 
pass   
 
pass   
 +
</syntaxhighlight>
 +
 +
<syntaxhighlight lang=matlab>
 +
%% Signal in Time Domain
 +
% Use Fourier transforms to find the frequency components of a signal buried in noise.
 +
% Specify the parameters of a signal with a sampling frequency of 1 kHz and a signal duration of 1.5 seconds
 +
Fs = 1000;            % Sampling frequency                   
 +
T = 1/Fs;            % Sampling period     
 +
L = 1500;            % Length of signal
 +
t = (0:L-1)*T;        % Time vector
 +
 +
% Form a signal containing a 50 Hz sinusoid of amplitude 0.7 and a 120 Hz sinusoid of amplitude 1.
 +
S = 0.7*sin(2*pi*50*t) + sin(2*pi*120*t);
 +
 +
% Corrupt the signal with zero-mean white noise with a variance of 4.
 +
X = S + 2*randn(size(t));
 +
 +
% Plot the noisy signal in the time domain. It is difficult to identify the frequency components by looking at the signal X(t).
 +
subplot(311);
 +
plot(1000*t(1:200),X(1:200), 'b')
 +
title('Signal Corrupted with Zero-Mean Random Noise')
 +
xlabel('t (milliseconds)')
 +
ylabel('X(t)')
 +
hold on
 +
plot(1000*t(1:200),S(1:200),'r')
 +
hold off
 +
 
</syntaxhighlight>
 
</syntaxhighlight>

Edição das 16h02min de 9 de março de 2020

def quick_sort(arr):
	less = []
	pivot_list = []
	more = []
	if len(arr) <= 1:
		return arr
	else:
		pass
%% Signal in Time Domain 
% Use Fourier transforms to find the frequency components of a signal buried in noise.
% Specify the parameters of a signal with a sampling frequency of 1 kHz and a signal duration of 1.5 seconds
Fs = 1000;            % Sampling frequency                    
T = 1/Fs;             % Sampling period       
L = 1500;             % Length of signal
t = (0:L-1)*T;        % Time vector

% Form a signal containing a 50 Hz sinusoid of amplitude 0.7 and a 120 Hz sinusoid of amplitude 1.
S = 0.7*sin(2*pi*50*t) + sin(2*pi*120*t);

% Corrupt the signal with zero-mean white noise with a variance of 4.
X = S + 2*randn(size(t));

% Plot the noisy signal in the time domain. It is difficult to identify the frequency components by looking at the signal X(t).
subplot(311);
plot(1000*t(1:200),X(1:200), 'b')
title('Signal Corrupted with Zero-Mean Random Noise')
xlabel('t (milliseconds)')
ylabel('X(t)')
hold on
plot(1000*t(1:200),S(1:200),'r')
hold off