MATLAB Answers


Trajectory designing Matlab code

Asked by Bilal sadiq on 26 Jun 2018
Latest activity Commented on by Bilal sadiq on 27 Jun 2018
Hi Dear all i want to make a trajectory path which i have done but i am unable to get the output in simulink please help me fast what mistake i am doing????
function [a3,a2,a1,a0]= TrajCreate(theta0,thetaf,thetad0,thetadf,t)
a0 = theta0;
a1 = thetad0;
a2 = (-3 * (theta0 - thetaf) - (2 * thetad0+thetadf )*T)/ T ^ 2;
a3 = (2 * (theta0 - thetaf) + (thetad0+thetadf )*T)/ T ^ 3;
% Run File theta0=10; thetaf=50; thetad0=0; thetadf=0;
p=[a3 ,a2 , a1 , a0];
This give me nice result but i want the Pos my output in simulink
can you some one please help me
thanks in advance

  1 Comment

Still no one interested to answer Plz help me

Sign in to comment.


3 Answers

Answer by Ameer Hamza
on 26 Jun 2018

You can use From Workspace block to transfer trajectory signal data from MATLAB base workspace to Simulink.


Sign in to comment.

Answer by Bilal sadiq on 26 Jun 2018

I have already done that but unable to get that Well I am not a newbie to matlab I know all these basics Please provide me some example


Ameer Hamza
on 26 Jun 2018
Here is a simple example demonstrating how to use From Workspace to get base workspace data in Simulink.
First, run this code to create sample data:
t = 0:0.1:10;
y = t.^2;
data = [t' y'];
Then run the attached Simulink model. Also check the setting of the From Workspace block to see how to set the variable name.
The file you attached is not working
Ameer Hamza
on 27 Jun 2018
What is the error?

Sign in to comment.

Answer by Bilal sadiq on 27 Jun 2018

how can i run the file ?when i open your .mdl file it open like some .txt file format and it is not getting download


Ameer Hamza
on 27 Jun 2018
Right-click on the file name and press Save Link as. Also instead of starting a new answer, it is better to keep comment on the original answer. It helps keep track of the things.
I have windows 10 it is not showing save link as............... instead it is showing Save linked content as................ and i have tried it is not working

Sign in to comment.