Trajectory designing Matlab code
이전 댓글 표시
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)
T=20;
a0 = theta0;
a1 = thetad0;
a2 = (-3 * (theta0 - thetaf) - (2 * thetad0+thetadf )*T)/ T ^ 2;
a3 = (2 * (theta0 - thetaf) + (thetad0+thetadf )*T)/ T ^ 3;
end
% Run File theta0=10; thetaf=50; thetad0=0; thetadf=0;
[a3,a2,a1,a0]=TrajCreate(theta0,thetaf,thetad0,thetadf)
p=[a3 ,a2 , a1 , a0];
t=linspace(0,20,100);
Pos=polyval(p,t)
plot(t,Pos)
This give me nice result but i want the Pos my output in simulink
can you some one please help me
thanks in advance
답변 (3개)
Ameer Hamza
2018년 6월 26일
0 개 추천
You can use From Workspace block to transfer trajectory signal data from MATLAB base workspace to Simulink.
Bilal sadiq
2018년 6월 26일
0 개 추천
댓글 수: 5
Ameer Hamza
2018년 6월 26일
편집: Ameer Hamza
2018년 6월 26일
"I have already done that but unable to get that"
please explain the problem in detail. It is difficult to guess the problem you are facing. Please provide more detail of what is not working and if possible attach a sample model and dataset with your comment.
Bilal sadiq
2018년 6월 26일
Ameer Hamza
2018년 6월 26일
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.
Bilal sadiq
2018년 6월 27일
Ameer Hamza
2018년 6월 27일
What is the error?
Bilal sadiq
2018년 6월 27일
0 개 추천
댓글 수: 2
Ameer Hamza
2018년 6월 27일
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.
Bilal sadiq
2018년 6월 27일
카테고리
도움말 센터 및 File Exchange에서 Discontinuities에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
