To plot the model error against time

Anyone please help me plot the model error against time in the subplot(212)
V=20;
t_sim=30;
sample_distance=0.2;
ts=sample_distance/V;
collect_ts=ts*1;
t_plot=(0:collect_ts:t_sim);

 採用された回答

Mischa Kim
Mischa Kim 2014 年 2 月 17 日
編集済み: Mischa Kim 2014 年 2 月 17 日

0 投票

Priya, the "correct" syntax for subplots is:
subplot(2,1,1) % notice the commas
Other than that, what is
size(deltaSignal)
size(percentageDifference)
And finally, I believe what you are trying to do is:
plot(deltaSignal,percentageDifference)

3 件のコメント

Mischa Kim
Mischa Kim 2014 年 2 月 17 日
With
t_sim = 30;
you could simply do
t_psim = linspace(0,t_sim,length(percentageDifference))
plot(t_psim,percentageDifference)
You are using as x-axis deltaSignal(:) which does not seem to be related to time. Am I missing something?
Priya
Priya 2014 年 2 月 17 日
I got it now.That was of great help Kim. Thanks very much.
Mischa Kim
Mischa Kim 2014 年 2 月 17 日
I do not know what exactly your variables mean, I am trying to interpret based on your code and information. It seems that in
deltaSignal = abs(simout_ss(:,19)-simout_b(:,19));
you compute the difference between two signals (models?) and in
percentageDifference=deltaSignal./simout_b(:,19);
you calculate the relative difference ( not percentage; for that you need to multiply the result by 100). So using
plot(t_psim,percentageDifference)
should plot what you are looking for.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

質問済み:

2014 年 2 月 16 日

編集済み:

2014 年 8 月 6 日

Community Treasure Hunt

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

Start Hunting!

Translated by