Code covered by the BSD License  

Highlights from
Using Analytical Tools to Gain Insight and Speed-up Num. Analysis in MATLAB & Symbolic Math Toolbox

image thumbnail

Using Analytical Tools to Gain Insight and Speed-up Num. Analysis in MATLAB & Symbolic Math Toolbox

by

 

28 Jan 2013 (Updated )

files from the webinar

MLDoubleLink_ImportSymbolicIK.m
%% Import Symbolic Equations into Simulink
% This script shows how to import symbolic expressions
% from a Symbolic Math Toolbox Notebook derivation directly into Simulink
% by using the matlabFunctionBlock() function that is part of the Symbolic
% Math Toolbox
%
%
% Copyright 2012 The MathWorks, Inc.
%% Open the Simulink model
% Open the Motion Control of a Two-Link Elbow Manipulator
% Simulink model
open('InverseKinematics.slx')

%% Open the MuPAD notebook
% Open the MuPAD notebook where the Inverse Kinematics
% equations are derived
nb = mupad('MUInverseKinematics.mn');

%% Read the symbolic expressions from MATLAB
% Read the symbolic expressions corresponding to the
% desired manipulator angles theta1 and theta2 from the
% notebook
% NOTE: You MUST EVALUATE THE NOTEBOOK manually before attempting
% to read the variables from MATLAB
th2des = getVar(nb,'TH2des');
th1des = getVar(nb,'TH1des');

%% Generate MATLAB function blocks in Simulink
% Two blocks will appear in the appropriate subsystem in the model
% The two blocks may appear on top of each other. Drag and connect these
% blocks. After this step Symbolic Math Toolbox functions are not needed
% for performing further steps including in Simulink
matlabFunctionBlock('InverseKinematics/calcTH1des',th1des);
matlabFunctionBlock('InverseKinematics/calcTH2des',th2des);

Contact us