-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a4fbe99
commit c5cf3cf
Showing
133 changed files
with
1,050 additions
and
7 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
|
||
<!DOCTYPE html | ||
PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> | ||
<html><head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | ||
<!-- | ||
This HTML was auto-generated from MATLAB code. | ||
To make changes, update the MATLAB code and republish this document. | ||
--><title>Ball on Grid Surface</title><meta name="generator" content="MATLAB 9.11"><link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"><meta name="DC.date" content="2021-09-17"><meta name="DC.source" content="sm_membrane_ball.m"><style type="text/css"> | ||
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}:focus{outine:0}ins{text-decoration:none}del{text-decoration:line-through}table{border-collapse:collapse;border-spacing:0} | ||
|
||
html { min-height:100%; margin-bottom:1px; } | ||
html body { height:100%; margin:0px; font-family:Arial, Helvetica, sans-serif; font-size:10px; color:#000; line-height:140%; background:#fff none; overflow-y:scroll; } | ||
html body td { vertical-align:top; text-align:left; } | ||
|
||
h1 { padding:0px; margin:0px 0px 25px; font-family:Arial, Helvetica, sans-serif; font-size:1.5em; color:#d55000; line-height:100%; font-weight:normal; } | ||
h2 { padding:0px; margin:0px 0px 8px; font-family:Arial, Helvetica, sans-serif; font-size:1.2em; color:#000; font-weight:bold; line-height:140%; border-bottom:1px solid #d6d4d4; display:block; } | ||
h3 { padding:0px; margin:0px 0px 5px; font-family:Arial, Helvetica, sans-serif; font-size:1.1em; color:#000; font-weight:bold; line-height:140%; } | ||
|
||
a { color:#005fce; text-decoration:none; } | ||
a:hover { color:#005fce; text-decoration:underline; } | ||
a:visited { color:#004aa0; text-decoration:none; } | ||
|
||
p { padding:0px; margin:0px 0px 20px; } | ||
img { padding:0px; margin:0px 0px 20px; border:none; } | ||
p img, pre img, tt img, li img, h1 img, h2 img { margin-bottom:0px; } | ||
|
||
ul { padding:0px; margin:0px 0px 20px 23px; list-style:square; } | ||
ul li { padding:0px; margin:0px 0px 7px 0px; } | ||
ul li ul { padding:5px 0px 0px; margin:0px 0px 7px 23px; } | ||
ul li ol li { list-style:decimal; } | ||
ol { padding:0px; margin:0px 0px 20px 0px; list-style:decimal; } | ||
ol li { padding:0px; margin:0px 0px 7px 23px; list-style-type:decimal; } | ||
ol li ol { padding:5px 0px 0px; margin:0px 0px 7px 0px; } | ||
ol li ol li { list-style-type:lower-alpha; } | ||
ol li ul { padding-top:7px; } | ||
ol li ul li { list-style:square; } | ||
|
||
.content { font-size:1.2em; line-height:140%; padding: 20px; } | ||
|
||
pre, code { font-size:12px; } | ||
tt { font-size: 1.2em; } | ||
pre { margin:0px 0px 20px; } | ||
pre.codeinput { padding:10px; border:1px solid #d3d3d3; background:#f7f7f7; } | ||
pre.codeoutput { padding:10px 11px; margin:0px 0px 20px; color:#4c4c4c; } | ||
pre.error { color:red; } | ||
|
||
@media print { pre.codeinput, pre.codeoutput { word-wrap:break-word; width:100%; } } | ||
|
||
span.keyword { color:#0000FF } | ||
span.comment { color:#228B22 } | ||
span.string { color:#A020F0 } | ||
span.untermstring { color:#B20000 } | ||
span.syscmd { color:#B28C00 } | ||
span.typesection { color:#A0522D } | ||
|
||
.footer { width:auto; padding:10px 0px; margin:25px 0px 0px; border-top:1px dotted #878787; font-size:0.8em; line-height:140%; font-style:italic; color:#878787; text-align:left; float:none; } | ||
.footer p { margin:0px; } | ||
.footer a { color:#878787; } | ||
.footer a:hover { color:#878787; text-decoration:underline; } | ||
.footer a:visited { color:#878787; } | ||
|
||
table th { padding:7px 5px; text-align:left; vertical-align:middle; border: 1px solid #d6d4d4; font-weight:bold; } | ||
table td { padding:7px 5px; text-align:left; vertical-align:top; border:1px solid #d6d4d4; } | ||
|
||
|
||
|
||
|
||
|
||
</style></head><body><div class="content"><h1>Ball on Grid Surface</h1><!--introduction--><p>This example models contact between spheres and a grid surface. The geometry of the sphere is modeled as a point cloud and the surface is modeled using the Grid Surface block.</p><!--/introduction--><h2>Contents</h2><div><ul><li><a href="#1">Model</a></li><li><a href="#3">Simulation Results from Simscape Logging: Membrane (1), 100 points</a></li><li><a href="#4">Simulation Results from Simscape Logging: Membrane (1), 200 points</a></li><li><a href="#5">Simulation Results from Simscape Logging: Membrane (6), 200 points</a></li><li><a href="#6">Simulation Results from Simscape Logging: Membrane (6), 200 points, Short Stem</a></li></ul></div><h2 id="1">Model</h2><img vspace="5" hspace="5" src="sm_membrane_ball_01.png" alt=""> <p><img vspace="5" hspace="5" src="sm_membrane_ball_mechExpAnim_membr1.png" alt=""> </p><h2 id="3">Simulation Results from Simscape Logging: Membrane (1), 100 points</h2><p>Plot ball velocities as the ball falls on the first eigenfunction of the L-shaped membrane. 100 points are used for the point cloud.</p><img vspace="5" hspace="5" src="sm_membrane_ball_02.png" alt=""> <h2 id="4">Simulation Results from Simscape Logging: Membrane (1), 200 points</h2><p>Plot ball velocities as the ball falls on the first eigenfunction of the L-shaped membrane. 100 points are used for the point cloud.</p><img vspace="5" hspace="5" src="sm_membrane_ball_03.png" alt=""> <h2 id="5">Simulation Results from Simscape Logging: Membrane (6), 200 points</h2><p>Plot ball velocities as the ball falls on the first eigenfunction of the L-shaped membrane. 100 points are used for the point cloud.</p><img vspace="5" hspace="5" src="sm_membrane_ball_04.png" alt=""> <h2 id="6">Simulation Results from Simscape Logging: Membrane (6), 200 points, Short Stem</h2><p>Plot ball velocities as the ball falls on the first eigenfunction of the L-shaped membrane. 100 points are used for the point cloud.</p><img vspace="5" hspace="5" src="sm_membrane_ball_05.png" alt=""> <p class="footer">Copyright 2021 The MathWorks, Inc.<br><a href="https://www.mathworks.com/products/matlab/">Published with MATLAB® R2021b</a><br></p></div><!-- | ||
##### SOURCE BEGIN ##### | ||
%% Ball on Grid Surface | ||
% | ||
% This example models contact between spheres and a grid surface. The | ||
% geometry of the sphere is modeled as a point cloud and the surface is | ||
% modeled using the Grid Surface block. | ||
% | ||
% Copyright 2021 The MathWorks, Inc. | ||
%% Model | ||
open_system('sm_membrane_ball') | ||
set_param(find_system('sm_membrane_ball','FindAll', 'on','type','annotation','Tag','ModelFeatures'),'Interpreter','off') | ||
%% | ||
% | ||
% <<sm_membrane_ball_mechExpAnim_membr1.png>> | ||
% | ||
%% Simulation Results from Simscape Logging: Membrane (1), 100 points | ||
% | ||
% Plot ball velocities as the ball falls on the first eigenfunction of the | ||
% L-shaped membrane. 100 points are used for the point cloud. | ||
% | ||
[grid_x, grid_y, grid_h] = membrane_grid_params(1,[1 1 1]); | ||
sphere_ptcld = Point_Cloud_Data_Sphere(sphere_radius,100); | ||
sim('sm_membrane_ball'); | ||
sm_membrane_ball_plot1ballvel; | ||
%% Simulation Results from Simscape Logging: Membrane (1), 200 points | ||
% | ||
% Plot ball velocities as the ball falls on the first eigenfunction of the | ||
% L-shaped membrane. 100 points are used for the point cloud. | ||
% | ||
[grid_x, grid_y, grid_h] = membrane_grid_params(1,[1 1 1]); | ||
sphere_ptcld = Point_Cloud_Data_Sphere(sphere_radius,200); | ||
sim('sm_membrane_ball'); | ||
sm_membrane_ball_plot1ballvel; | ||
%% Simulation Results from Simscape Logging: Membrane (6), 200 points | ||
% | ||
% Plot ball velocities as the ball falls on the first eigenfunction of the | ||
% L-shaped membrane. 100 points are used for the point cloud. | ||
% | ||
[grid_x, grid_y, grid_h] = membrane_grid_params(6,[1 1 1]); | ||
sphere_ptcld = Point_Cloud_Data_Sphere(sphere_radius,200); | ||
sim('sm_membrane_ball'); | ||
sm_membrane_ball_plot1ballvel; | ||
%% Simulation Results from Simscape Logging: Membrane (6), 200 points, Short Stem | ||
% | ||
% Plot ball velocities as the ball falls on the first eigenfunction of the | ||
% L-shaped membrane. 100 points are used for the point cloud. | ||
% | ||
[grid_x, grid_y, grid_h] = membrane_grid_params(6,[1 1 1]); | ||
sphere_ptcld = Point_Cloud_Data_Sphere(sphere_radius,200); | ||
stem_len = 0.2; | ||
[ptcld_stem, extr_data_stem] = stem_params(stem_len,stem_rmax,stem_rmin); | ||
sim('sm_membrane_ball'); | ||
sm_membrane_ball_plot1ballvel; | ||
%% | ||
%clear all | ||
close all | ||
bdclose all | ||
##### SOURCE END ##### | ||
--></body></html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+127 KB
Models/Mesh_Grid/Overview/html/sm_membrane_ball_mechExpAnim_membr1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
%% Ball on Grid Surface | ||
% | ||
% This example models contact between spheres and a grid surface. The | ||
% geometry of the sphere is modeled as a point cloud and the surface is | ||
% modeled using the Grid Surface block. | ||
% | ||
% Copyright 2021 The MathWorks, Inc. | ||
|
||
|
||
|
||
%% Model | ||
|
||
open_system('sm_membrane_ball') | ||
|
||
set_param(find_system('sm_membrane_ball','FindAll', 'on','type','annotation','Tag','ModelFeatures'),'Interpreter','off') | ||
|
||
%% | ||
% | ||
% <<sm_membrane_ball_mechExpAnim_membr1.png>> | ||
% | ||
|
||
%% Simulation Results from Simscape Logging: Membrane (1), 100 points | ||
% | ||
% Plot ball velocities as the ball falls on the first eigenfunction of the | ||
% L-shaped membrane. 100 points are used for the point cloud. | ||
% | ||
|
||
[grid_x, grid_y, grid_h] = membrane_grid_params(1,[1 1 1]); | ||
sphere_ptcld = Point_Cloud_Data_Sphere(sphere_radius,100); | ||
sim('sm_membrane_ball'); | ||
sm_membrane_ball_plot1ballvel; | ||
|
||
%% Simulation Results from Simscape Logging: Membrane (1), 200 points | ||
% | ||
% Plot ball velocities as the ball falls on the first eigenfunction of the | ||
% L-shaped membrane. 100 points are used for the point cloud. | ||
% | ||
|
||
[grid_x, grid_y, grid_h] = membrane_grid_params(1,[1 1 1]); | ||
sphere_ptcld = Point_Cloud_Data_Sphere(sphere_radius,200); | ||
sim('sm_membrane_ball'); | ||
sm_membrane_ball_plot1ballvel; | ||
|
||
%% Simulation Results from Simscape Logging: Membrane (6), 200 points | ||
% | ||
% Plot ball velocities as the ball falls on the first eigenfunction of the | ||
% L-shaped membrane. 100 points are used for the point cloud. | ||
% | ||
|
||
[grid_x, grid_y, grid_h] = membrane_grid_params(6,[1 1 1]); | ||
sphere_ptcld = Point_Cloud_Data_Sphere(sphere_radius,200); | ||
sim('sm_membrane_ball'); | ||
sm_membrane_ball_plot1ballvel; | ||
|
||
%% Simulation Results from Simscape Logging: Membrane (6), 200 points, Short Stem | ||
% | ||
% Plot ball velocities as the ball falls on the first eigenfunction of the | ||
% L-shaped membrane. 100 points are used for the point cloud. | ||
% | ||
|
||
[grid_x, grid_y, grid_h] = membrane_grid_params(6,[1 1 1]); | ||
sphere_ptcld = Point_Cloud_Data_Sphere(sphere_radius,200); | ||
stem_len = 0.2; | ||
[ptcld_stem, extr_data_stem] = stem_params(stem_len,stem_rmax,stem_rmin); | ||
|
||
sim('sm_membrane_ball'); | ||
sm_membrane_ball_plot1ballvel; | ||
|
||
|
||
%% | ||
|
||
%clear all | ||
close all | ||
bdclose all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
function [grid_x, grid_y, grid_h] = membrane_grid_params(K,scale_xyz,varargin) | ||
% Generate grid surface points from L-shaped membrane eigenfunctions. | ||
% | ||
% Copyright 2021 The MathWorks, Inc. | ||
|
||
% Default data to show diagram | ||
if (nargin == 0) | ||
K=1; | ||
scale_xyz = [1 1 1]; | ||
showplot = 'plot'; | ||
end | ||
|
||
% Check if plot should be produced | ||
if (isempty(varargin)) | ||
showplot = 'n'; | ||
else | ||
showplot = varargin; | ||
end | ||
|
||
grid_h = membrane(K)*scale_xyz(3); | ||
grid_x = linspace(-1,1,size(grid_h,1))*scale_xyz(1); | ||
grid_y = linspace(-1,1,size(grid_h,2))*scale_xyz(2); | ||
|
||
% Plot diagram to show parameters and extrusion | ||
if (nargin == 0 || strcmpi(showplot,'plot')) | ||
|
||
% Figure name | ||
figString = ['h1_' mfilename]; | ||
% Only create a figure if no figure exists | ||
figExist = 0; | ||
fig_hExist = evalin('base',['exist(''' figString ''')']); | ||
if (fig_hExist) | ||
figExist = evalin('base',['ishandle(' figString ') && strcmp(get(' figString ', ''type''), ''figure'')']); | ||
end | ||
if ~figExist | ||
fig_h = figure('Name',figString); | ||
assignin('base',figString,fig_h); | ||
else | ||
fig_h = evalin('base',figString); | ||
end | ||
figure(fig_h) | ||
clf(fig_h) | ||
|
||
%temp_colororder = get(gca,'defaultAxesColorOrder'); | ||
|
||
surf(grid_x, grid_y, grid_h,'LineWidth',0.01,'EdgeColor',[0.6 0.6 0.6]) | ||
box on | ||
|
||
title(['[grid\_x, grid\_y, grid\_h] = membrane\_grid\_params(K, scale\_xyz);']); | ||
hold off | ||
box on | ||
axis equal | ||
grid off | ||
end |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
% Load parameters for sm_membrane_ball | ||
% Copyright 2021 The MathWorks, Inc. | ||
|
||
% Contact parameters | ||
sph_mem_k = 2e4; | ||
sph_mem_b = 5e2; | ||
sph_mem_trs_w = 1e-4; | ||
|
||
% Define membrane | ||
[grid_x, grid_y, grid_h] = membrane_grid_params(1,[1 1 1]); | ||
|
||
% Define spheres | ||
sphere_radius = 0.1; | ||
sphere_ptcld = Point_Cloud_Data_Sphere(sphere_radius,200); | ||
sphere_half_extr_data =[0 0;cos(0:pi/2/20:pi/2)' sin(0:pi/2/20:pi/2)']*sphere_radius; | ||
|
||
% Expression to only use points on half the sphere | ||
%sphere_ptcld_half = sphere_ptcld(sphere_ptcld(:,3)>0,:); | ||
|
||
% Parameters for stem | ||
stem_len = 0.4; | ||
stem_rmax = sphere_radius; | ||
stem_rmin = 0.03; | ||
|
||
% Generate point cloud and extrusion for stem | ||
[ptcld_stem, extr_data_stem] = stem_params(stem_len,stem_rmax,stem_rmin); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
% Code to plot simulation results from sm_membrane_ball | ||
%% Plot Description: | ||
% | ||
% Plot ball velocities as the ball falls on the first eigenfunction of the | ||
% L-shaped membrane. 100 points are used for the point cloud. | ||
% | ||
% Copyright 2021 The MathWorks, Inc. | ||
|
||
% Generate simulation results if they don't exist | ||
if ~exist('simlog_sm_membrane_ball', 'var') | ||
sim('sm_membrane_ball') | ||
end | ||
|
||
% Reuse figure if it exists, else create new figure | ||
if ~exist('h1_sm_membrane_ball', 'var') || ... | ||
~isgraphics(h1_sm_membrane_ball, 'figure') | ||
h1_sm_membrane_ball = figure('Name', 'sm_membrane_ball'); | ||
end | ||
figure(h1_sm_membrane_ball) | ||
clf(h1_sm_membrane_ball) | ||
|
||
temp_colororder = get(gca,'defaultAxesColorOrder'); | ||
|
||
% Get simulation results | ||
simlog_t = simlog_sm_membrane_ball.Joint_Ball_1.Pz.v.series.time; | ||
simlog_b1z = simlog_sm_membrane_ball.Joint_Ball_1.Pz.v.series.values; | ||
simlog_b2z = simlog_sm_membrane_ball.Joint_Weight.Pz.v.series.values; | ||
simlog_b1x = simlog_sm_membrane_ball.Joint_Ball_1.Px.v.series.values; | ||
simlog_b2x = simlog_sm_membrane_ball.Joint_Weight.Px.v.series.values; | ||
|
||
% Plot results | ||
simlog_handles(1) = subplot(2, 1, 1); | ||
plot(simlog_t, simlog_b2z, 'LineWidth', 1,'DisplayName','Ball 1') | ||
hold on | ||
plot(simlog_t, simlog_b1z, 'LineWidth', 1,'DisplayName','Ball 2') | ||
hold off | ||
grid on | ||
title('Ball Vertical Velocity') | ||
ylabel('Velocity (m/s)') | ||
legend('Location','Best'); | ||
|
||
simlog_handles(2) = subplot(2, 1, 2); | ||
plot(simlog_t, simlog_b2x, 'LineWidth', 1,'DisplayName','Ball 1') | ||
hold on | ||
plot(simlog_t, simlog_b1x, 'LineWidth', 1,'DisplayName','Ball 2') | ||
hold off | ||
grid on | ||
title('Ball Velocity Along Global X') | ||
ylabel('Velocity (m/s)') | ||
xlabel('Time (s)') | ||
|
||
linkaxes(simlog_handles, 'x') | ||
|
||
% Remove temporary variables | ||
clear simlog_t simlog_handles | ||
clear simlog_R1i simlog_C1v temp_colororder | ||
|
Oops, something went wrong.