Plot 2 D traiectory

4 ビュー (過去 30 日間)
Adriana Maria
Adriana Maria 2018 年 6 月 2 日
回答済み: Divyajyoti Nayak 2024 年 9 月 6 日
Hi,
I want to plot the trajectory of car based on lateral and longitudinal vehicle speed. I have a simulink model, where are calculated the lateral and longitudinal vehicle speeds, and I want to plot the trajectory. I have tried to use XYGraph but this block don't have the autoscale option and zoom out/in. How to plot the otherwise the trajectory of the car?

回答 (1 件)

Divyajyoti Nayak
Divyajyoti Nayak 2024 年 9 月 6 日
Hi Adriana,
The ‘XY Graph’ block has been improved in MATLAB R2021b and above by replacing it with a configuration of the ‘record’ block which has the features you have mentioned like autofit, zooming etc.
As a workaround for earlier versions, you can directly plot the position data in a MATLAB figure by writing it in the ‘StopFcn’ callback of the model (Model Properties -> Callbacks -> StopFcn) like shown below.
Here ‘out’ is the outout variable logged in the workspace in the form of an array (You’ll have to configure this in Configuration Parameters (Ctrl + E)->Data Inport/Outport’).
Sample model and output:

カテゴリ

Help Center および File ExchangeAutomated Driving Toolbox についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by