?? poincare.m
字號:
%% dat_2(ii) = round(dat_2(ii));
%% end
%% if abs(dat_3(ii))>1
%% dat_3(ii) = round(dat_3(ii));
%% end
%% if abs(dat_4(ii))>1
%% dat_4(ii) = round(dat_4(ii));
%% end
%% end
% Stokes vectors transform to cartesian x, y, z in a simple manner:
x = dat_1;
y = dat_2;
z = dat_3;
% plot data
figure('Position',[183 70 500 600]);
%hold on;
%[X,Y,Z] = ellipsoid(0,0,0,0.95,0.95,0.95,20); % create nearly-unit 3-D sphere with 20x20 grid; can also use "sphere(20)"
[X,Y,Z] = sphere(20);
X = X;
Y = Y;
Z = Z;
Hs = mesh(X,Y,Z,'facecolor','w','edgecolor',[0.5 0.5 0.5]); % set grid facecolor to white
caxis([1.0 1.01]); % set grid to appear like all one color
alpha(0.70); % set opacity of sphere to 70%
axis equal; % make the three axes equal so the ellipsoid looks like a sphere
set(gcf,'Renderer','opengl');
hold on;
% Draw x- and y- and z-axes
Hx = plot3([-1.5 1.5], [0 0], [0 0],'k-');
set(Hx,'linewidth',2,'linestyle','-','color','k');
ht_x = text(1.75,0,0,'+S_1','fontweight','bold','fontsize',12,'fontname','arial');
Hy = plot3([0 0], [-1.5 1.5], [0 0],'k-');
set(Hy,'linewidth',2,'linestyle','-','color','k');
ht_y = text(0.1,1.6,0,'+S_2','fontweight','bold','fontsize',12,'fontname','arial');
Hz = plot3([0 0], [0 0], [-1.5 1.5],'k-');
set(Hz,'linewidth',2,'linestyle','-','color','k');
ht_z = text(-0.05,0,1.35,'+S_3','fontweight','bold','fontsize',12,'fontname','arial');
ht_lcp = text(-0.05,0.0,1.1,'RCP','fontweight','bold','fontsize',12,'fontname','arial','color','k');
% Draw a bold circle about the equator (2*epsilon = 0)
x_e = (-1:.01:1);
for i = 1:length(x_e)
z_e(i) = 0;
y_e_p(i) = +sqrt(1 - x_e(i)^2);
y_e_n(i) = -sqrt(1 - x_e(i)^2);
end
He = plot3(x_e,y_e_p,z_e,'k-',x_e,y_e_n,z_e,'k-');
set(He,'linewidth',2,'color','k');
% Draw a bold circle about the prime meridian (2*theta = 0, 180)
y_pm = (-1:.01:1);
for i = 1:length(x_e)
x_pm(i) = 0;
z_pm_p(i) = +sqrt(1 - y_pm(i)^2);
z_pm_n(i) = -sqrt(1 - y_pm(i)^2);
end
Hpm = plot3(x_pm,y_pm,z_pm_p,'k-',x_pm,y_pm,z_pm_n,'k-');
set(Hpm,'linewidth',2,'color','k');
% Now plot the polarimetry data
H = plot3(x,y,z,'m.');
set(gca,'fontweight','bold','fontsize',12,'fontname','arial');
set(H,'markersize',15,'markeredgecolor','m','markerfacecolor','m','color','m','linewidth',0.1);
%H = plot3(x(100:120),y(100:120),z(100:120),'m-.');
%set(gca,'fontweight','bold','fontsize',12,'fontname','arial');
%set(H,'markersize',12,'markeredgecolor','m','markerfacecolor','m','color','m','linewidth',2);
view(135,20); % change the view angle
%alpha(0.70); % set opacity of sphere to 70%
%ylim(gca,[0 120]);
%xlabel('S1');
%ylabel('S2');
%zlabel('S3');
line_1 = 'Plot of Poincare Sphere';
line_2_1 = '(input filename: "';
line_2_2 = '")';
line_2 = [line_2_1 strrep(input_filename,'_','\_') line_2_2];
title({line_1; line_2});
%legend('data');
%line width of legend
h = findobj('type', 'axes'); % Find all sets of axes
set(h(1), 'linewidth',2) % Making the vertical lines blend in with the background
set(h(1), 'linewidth',2) % Making the horizontal lines blend in with the background
%set(H,'markersize',8,'color','m');
% Get info for plotting text boxes on screen
x_rng = xlim; % range of horizontal axis
y_rng = ylim; % range of initial right vertical axis
delta_x = x_rng(2) - x_rng(1);
delta_y = y_rng(2) - y_rng(1);
% Get start/end details
time_i = dat_t(1);
time_f = dat_t(length(dat_t));
today = datestr(date,26); % produces format 2006/04/12
substr_1 = strcat(today,{' '},num2str(time_i),{' (Data start)\newline'});
substr_2 = strcat(today,{' '},num2str(time_f),{' (End)'});
dates_str = [substr_1 substr_2];
% Timestamp plot with start and stop times
ht_d = text(1.5,-1.0,-1.6, dates_str,'fontweight','bold','fontsize',10,'fontname','arial','BackgroundColor',[.7 .9 .7]);
% Save plot if user selected that option
% Default is not to save plot ('N')
cur_save_val = get(handles.edit1,'string'); % get current value in edit1
% Prevent clipping by increasing paperposition dimension
pp = get(gcf,'paperposition');
pp(4) = pp(4) + 1;
%pp(2) = pp(2) - 2.5;
set(gcf,'paperposition',pp);
if cur_save_val == 'Y'
save_plot = [savegraph_file(1:length(savegraph_file)),'.jpg'];
%% Save data plot to .jpg file and attach extension
saveas(gcf,save_plot);
% Reset to N (helps prevents overwriting graph files)
set(handles.edit1,'string','N') % write variable to edit1
set(handles.checkbox1,'value',0.0) % write variable to edit1end
guidata(gcbo,handles) % store the changes
end
end
function edit11_Callback(hObject, eventdata, handles)
% hObject handle to edit11 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit11 as text
% str2double(get(hObject,'String')) returns contents of edit11 as a double
end
% --- Executes during object creation, after setting all properties.
function edit11_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit11 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
end
function edit21_Callback(hObject, eventdata, handles)
% hObject handle to edit21 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit21 as text
% str2double(get(hObject,'String')) returns contents of edit21 as a double
end
% --- Executes during object creation, after setting all properties.
function edit21_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit21 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
end
function edit22_Callback(hObject, eventdata, handles)
% hObject handle to edit22 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit22 as text
% str2double(get(hObject,'String')) returns contents of edit22 as a double
% --- Executes during object creation, after setting all properties.
end
function edit22_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit22 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
end
function edit1_Callback(hObject, eventdata, handles)
% hObject handle to edit1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit1 as text
% str2double(get(hObject,'String')) returns contents of edit1 as a double
end
% --- Executes during object creation, after setting all properties.
function edit1_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
end
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -