SimScape Multibody to emulate Mirror reflecting light beam

38 visualizzazioni (ultimi 30 giorni)
Chenji Tu
Chenji Tu il 6 Dic 2024 alle 16:09
Risposto: Jaimin il 23 Dic 2024 alle 4:57
Dear community,
In the attached image you see that I attempt to emulate a scenario which a line laser beam is aiming at a rotating object.
The rotating object is a 4-mirror cubic, so that in reality at the contacting line, there is reflection.
As the emulated scenario, the contacting point (line) is moving in space, not fixed in space, as the mirror rotates.
My question is, is it possible to export the contacting position and angle as a timeseries data, for Matlab to analyze?
Background Info: I understand that in SimScape (or Simulink) there is no native components supporting optics.
But in the screenshot apparently we are able to simulate this scenario, and if we know how to export the contacting position and angle as a function of time, then it is possible to figure out in Matlab script, how in reality the line laser light is reflected, to which angle mostly.
Looking forward to your comments. Many thanks!

Risposte (1)

Jaimin
Jaimin il 23 Dic 2024 alle 4:57
I see that you are simulating a scenario in which a line laser beam reflects off a rotating cube with four mirrored sides, causing the contact point to move as the cube rotates. You are looking to export the contact position and angle as time series data for analysis in MATLAB.
Since SimScape and Simulink do not natively support optics, you might be utilizing a custom setup or a workaround to simulate the interaction between the laser and the rotating mirror cube. Make sure your simulation accurately represents the rotation and contact dynamics.
If your simulation setup permits, employ sensors or custom blocks to monitor the position and angle of the contact point between the laser and the mirror. This could involve determining the intersection of the laser line with the surface of the rotating mirrors.
Leverage Simulink's data logging to record position and angle data over time. Use To Workspace blocks to export this data to MATLAB as arrays or time series objects. Once exported, analyze the data in MATLAB by plotting trajectories or calculating reflection angles.
Kindly refer following code snippet for understanding.
% Load the exported data from Simulink
load('contactData.mat'); % Assuming you saved the data as a .mat file
% Extract time, position, and angle data
time = contactData.time;
position = contactData.signals.values(:, 1:3); % Assuming 3D position
angle = contactData.signals.values(:, 4); % Assuming angle is the 4th column
figure;
plot3(position(:,1), position(:,2), position(:,3));
xlabel('X Position');
ylabel('Y Position');
zlabel('Z Position');
title('Contact Point Trajectory');
figure;
plot(time, angle);
xlabel('Time (s)');
ylabel('Angle (degrees)');
title('Contact Angle Over Time');
For more information kindly refer following MathWorks documentation.
I hope this will helpful.

Prodotti


Release

R2024b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by