-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSpectrum_plot.m
49 lines (44 loc) · 1.44 KB
/
Spectrum_plot.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
% This program collects all the spectrum data in the folder in one 3D array
% and plots all the spectrums.
% clear all
% close all
% clc
set(groot,'defaultAxesTickLabelInterpreter','latex')
set(groot,'defaultLegendInterpreter','latex')
dir = uigetdir('D:\Users\Stinky\Google Drive\ITA\Disciplinas\Aquisicao de dados LabVIEW\Projeto\Dados adquiridos');
addpath(dir)
extension = '.lvm';
N = input('Qual o numero do ultimo arquivo na pasta? R:');
tempData = importdata('LabVIEW Data 0 .lvm');
y = tempData(:,2); %dBm
x = tempData(:,3); %mx
current = tempData(1,4); %mA
z = ones(length(x),1);
tempMatrix = zeros(0,N);
% figure
% hold on
for i=1:N+1
file = ['LabVIEW Data',' ',num2str(i-1),' ',extension];
tempData = importdata(file);
y = tempData(:,2); %dBm
x = tempData(:,3); %m
current = tempData(1,4) %mA
Data(:,:,i) = [tempData(:,3),tempData(:,2)];
z(:,i) = current;
% plot3(x,y,repmat(current,size(x)))
end
figure('Units','centimeter','Position',[10 10 30 12],'PaperPositionMode','auto')
X = squeeze(Data(:,1,:));
Y = squeeze(Data(:,2,:));
Z = z;
mesh(X,Y,Z)
view([-20,20,-45])
camup([0 1 0]);
set(gca,'Xdir','reverse')
xlabel('Comprimento de onda [m]','interpreter','latex','FontSize',12)
ylabel('Potencia Optica [dBm]','interpreter','latex','FontSize',12)
zlabel('Corrente do Laser diodo [mA]','interpreter','latex','FontSize',12)
% fig1=figure(1);
% fig1.Renderer='Painters';
% saveas(gcf, 'out.eps', 'epsc');
% epsclean('espectrosmesh_2017.eps','groupSoft',true);