MATLAB Answers

How to impliment efficient the next expression?

1 view (last 30 days)
Dimitrios on 20 Oct 2014
Commented: Dimitrios on 20 Oct 2014
I have the following expression:
a_dot is the rate of change of an angle.So it equals with Da/Dt.I am wondering what should i do for the first value as there is no previous value to calculate the Da.I will calculate it like a_dot(1) = a(1)/(timestep/2). So my question is how to impliment that eficient/vectorized as this calculations are inside a loop with many repeats.I tried the following but ofcurse it didnt work as there is no index = 0 :
size(angleofattack) = 1x36 double
Any ideas? Thanks in advance.

  1 Comment

Dimitrios on 20 Oct 2014
I managed this one:
([angleofattack(1) diff(angleofattack)])/obj.timestepPerThitaNode/(1+(angleofattack(1)==1));
But any other solutions are welcome.

Sign in to comment.

Answers (0)

Sign in to answer this question.

Translated by