필터 지우기
필터 지우기

Adding the stl file to the Matlab simulation

조회 수: 4 (최근 30일)
Aleyna
Aleyna 2024년 1월 16일
댓글: Star Strider 2024년 1월 29일
I created a simulation in Matlab, but the satellite in the simulation looks like a normal rectangle. I want to replace that satellite with a satellite with a stl file. How can I write a code to add the stl file to the simulation?
When I run this code with the relevant places, I get the satellite output in the comments. But as I said, I want to replace it with stl file, how can I do it?
mass_spcrft = 2.6; %[kg] *Range: mass_spcrft > 0.0
dimnsnsX_spcrft = 0.1; %[m] *Range: dimnsnsX_spcrft > 0.0
dimnsnsY_spcrft = 0.1; %[m] *Range: dimnsnsY_spcrft > 0.0
dimnsnsZ_spcrft = 0.2; %[m] *Range: dimnsnsZ_spcrft > 0.0
inrtaTnsr_spcrft = [0.0108, 0, 0;
0, 0.0108, 0;
0, 0, 0.0043];
dimnsns_spcrft(1) = dimnsnsX_spcrft;
dimnsns_spcrft(2) = dimnsnsY_spcrft;
dimnsns_spcrft(3) = dimnsnsZ_spcrft;
clear dimnsnsX_spcrft;
clear dimnsnsY_spcrft;
clear dimnsnsZ_spcrft;
plot3([0, max(dimnsns_spcrft / 2) + 0.05], [0, 0], [0, 0], 'Color', 'w', 'LineWidth', 2, 'Clipping', 'off');
plot3([0, 0], [0, max(dimnsns_spcrft / 2) + 0.05], [0, 0], 'Color', 'w', 'LineWidth', 2, 'Clipping', 'off');
plot3([0, 0], [0, 0], [0, max(dimnsns_spcrft / 2) + 0.05], 'Color', 'w', 'LineWidth', 2, 'Clipping', 'off');
text(max(dimnsns_spcrft / 2) + 0.1, 0, 0, 'X_I', 'Color', 'w');
text(0, max(dimnsns_spcrft / 2) + 0.1, 0, 'Y_I', 'Color', 'w');
text(0, 0, max(dimnsns_spcrft / 2) + 0.1, 'Z_I', 'Color', 'w');
spcrftTrnsfrm = hgtransform;
set(spcrft(dimnsns_spcrft, true), 'Parent', spcrftTrnsfrm);
  댓글 수: 1
Aleyna
Aleyna 2024년 1월 16일
Note: simulation comes out as figure (not simulink)

댓글을 달려면 로그인하십시오.

답변 (1개)

Star Strider
Star Strider 2024년 1월 16일
It depends what the .stl file is.
The first step would be to use the stlread function to import it, and then use trisurf (or one of its friends) to plot it. After that, use the view function to orient it to the way you want it.
  댓글 수: 2
Aleyna
Aleyna 2024년 1월 29일
I could not do the merging part of what you said with my own code anyway
Star Strider
Star Strider 2024년 1월 29일
I cannot help with that because I do not have the .stl fille.
If you want to post it, use the zip function and then upload the .zip file here. If I do not see it posted in a few hours, I will delete my Answer.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 STL (STereoLithography)에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by