how to draw or insert tangent line in my simulink result ie. speed Vs time graph ?

2 ビュー (過去 30 日間)
kandiban r
kandiban r 2011 年 8 月 27 日
I would like to plot Tangent Line in my Simulink (simpowersystem) result ie. speed vs time graph.
Kindly help me..

回答 (1 件)

Fangjun Jiang
Fangjun Jiang 2011 年 8 月 27 日
If you have the speed and time data, you can use gradient() to get the acceleration.
ts=0.1;
t=0:ts:7;
Speed=sin(t);
Accel=gradient(Speed,ts);
plot(t,Speed,'r',t,Accel,'b');
legend({'Speed','Accel'});
If you want to get it directly in Simulink, use a Derivative block. You might need to consider filtering first to remove noise.
Or do you mean this?
ts=0.5;
t=0:ts:4;
Speed=sin(t);
Accel=gradient(Speed,ts);
dt=gradient(t,ts);
plot(t,Speed);
hold on;quiver(t,Speed,dt,Accel);

カテゴリ

Help Center および File ExchangeModeling についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by