Modify Infinity Plot Matlab
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello everyone. I'm new in this comunity and it is my first question. I'm struggling with this problem and I don't know how to solve it. Thank you in advance for your help.
Problem: I have an infinity plot inside the while 1 cycle that plots an operating deflection shape (ODS) of a structure subplot(4,1,[3 4]) based on the selection of a point on the Hsum curve subplot(4,1,[1 2]). What I would like to do is interacting with this figure while the plot is moving in order to have the possibility to select a different point inside the Hsum curve and have the plot of the new data points into the figure. I was trying to solve this problem using a pushbutton (see the commented lines) that restart the for cycle and enters in the if q==1 for the new point selection.
Unfortunately it doesn't work properly and I think it is not the best way to solve the problem.
Can you give me an advice on how to solve this problem? Thank you
Reduction_fac = 2;
fps = 5;
t=linspace(0,60*2*pi,1000);
Hsum(1,1,:) = sum(sum(abs(real(H.H)),2),1)+j*sum(sum(abs(imag(H.H)),2),1);
figure;
g_pos=[0 0 1 1];
caz=-37.5;
cel=30;
max_dim_DIC=max(max(abs(pos)));
while 1
for q=1:length(t)
% if ~ishandle(ButtonHandle)
% q=1;
% figure;
% end
subplot(4,1,[1 2])
semilogy(H.f,abs(squeeze(Hsum(1,1,:))),'*');
ylabel('Magnitude');
title('FRF Sum');
xlim([f1 f2]);
% ButtonHandle = uicontrol('Style', 'PushButton', 'String', 'Select another frequency line', 'Callback', 'delete(gcbf)', 'Position',[1740 900 150 20]);
if q==1
i=1;
dcm_obj = datacursormode;
set(dcm_obj,'DisplayStyle','window','SnapToDataVertex','off','Enable','on')
waitforbuttonpress
c_info{i} = getCursorInfo(dcm_obj); %#ok
Freq_line=c_info{1,i}.Position(1);
idx=find(H.f==Freq_line);
end
normal_DIC=max_dim_DIC/(Reduction_fac*max(abs(squeeze(H.H(:,:,idx)))));
subplot(4,1,[3 4])
scatter3(pos(:,1),pos(:,2),pos(:,3), 'bo')
set(gcf,'units','normalized','outerposition',g_pos)
set(gcf,'color','w');
axis equal
hold on
scatter3(pos(:,1),pos(:,2),pos(:,3)+cos(t(q)+angle(H.H(:,:,idx))).*abs(H.H(:,:,idx))*normal_DIC,40,abs(cos(t(q)+angle(H.H(:,:,idx))).*abs(H.H(:,:,idx))*max_dim_DIC/(Reduction_fac*max(abs(H.H(:,:,idx))))),'filled')
cb = colorbar;
if q==1; c_limits=get(cb,'Limits'); end
caxis(c_limits);
cb.Label.String = 'Magnitude';
zlim([-max(abs(pos(:,3)+abs(H.H(:,:,idx))*normal_DIC)) +max(abs(pos(:,3)+abs(H.H(:,:,idx))*normal_DIC))])
xlabel('x'); ylabel('y'); zlabel('z');
view(caz,cel);
hold off
box on
grid on
pause(1/fps)
[caz,cel]= view;
g_pos=get(gcf,'outerposition');
% c_info{i} = getCursorInfo(dcm_obj);
end
end
If something it is not clear or you need the input file for running the script and see the results just ask for it.
0 comentarios
Respuestas (0)
Ver también
Categorías
Más información sobre Graphics Object Programming en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!