16.04.2013 Views

Manuel Francisco da Costa Vitor - Estudo Geral - Universidade de ...

Manuel Francisco da Costa Vitor - Estudo Geral - Universidade de ...

Manuel Francisco da Costa Vitor - Estudo Geral - Universidade de ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

2. O novo sistema <strong>de</strong> aquisição <strong>de</strong> <strong>da</strong>dos<br />

do fluorómetro PAF<br />

*esta zona po<strong>de</strong> facilmente ser altera<strong>da</strong> se as características <strong>da</strong> curva assim o exigirem. Para<br />

tal basta alterar o intervalo <strong>de</strong>finido pela variável xfilt.<br />

function zonint(<strong>da</strong>ta,n)<br />

[a b]=size(<strong>da</strong>ta);<br />

x=(1:n);<br />

d=<strong>da</strong>ta(2:a,1:n);<br />

y=(d');<br />

[e f]=size (y);<br />

% Determine the maximum y <strong>da</strong>ta value<br />

max_y_value = max(max(y));<br />

[max_y_linha,max_y_coluna]=find(y==max_y_value);<br />

corresponding_x_value =max_y_linha;<br />

xfilt=(max_y_linha:max_y_linha+10);<br />

y1=y(xfilt,1:f);<br />

plot(xfilt,y1)<br />

xlabel('pixels seleccionados: [Xmax , Xmax+10]');<br />

ylabel('valores ADC');<br />

title('Zona <strong>de</strong> interesse');<br />

axis auto<br />

grid;<br />

filtmovel<br />

O gráfico gerado por esta função consiste num filtro <strong>de</strong> médias móveis<br />

(uma função pré-<strong>de</strong>fini<strong>da</strong> no MATLAB, <strong>de</strong> nome filter) <strong>de</strong> n valores passados<br />

em relação ao actual (por <strong>de</strong>feito, n=4). É aplicado a uma matriz que contém<br />

tantas colunas como o número <strong>de</strong> píxeis do sensor e um número <strong>de</strong> linhas<br />

igual ao número varrimento efectuado. Como resultado, o filtro é aplicado a<br />

ca<strong>da</strong> varrimento e obtêm-se seis curvas. Posteriormente é feita a média <strong>de</strong><br />

todos os varrimentos (já submetidos individualmente ao filtro) e gera<strong>da</strong> a<br />

imagem final, uma curva única.<br />

function filtmovel(<strong>da</strong>ta,n)<br />

[a b]=size (<strong>da</strong>ta);<br />

x=(1:n);<br />

d=<strong>da</strong>ta(2:a,1:n);<br />

y=(d');<br />

windowSize = 4; %regular o nº <strong>de</strong> elementos com que faz a média móvel<br />

f<strong>da</strong>ta=filter(ones(1,windowSize)/windowSize,1,y); % Aplicado o filtro<br />

filter<br />

plot(1:n,mean(f<strong>da</strong>ta'))<br />

axis auto<br />

grid<br />

45

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!