Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

How to impliment efficient the next expression?

조회 수: 1 (최근 30일)
Dimitrios
Dimitrios 2014년 10월 20일
마감: MATLAB Answer Bot 2021년 8월 20일
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 :
alphaRate=(alpha-(angleNode>1)*angleofattack(angleNode-1))/(obj.timestepPerThitaNode/(1+(angleNode==1)));
size(angleofattack) = 1x36 double
Any ideas? Thanks in advance.
  댓글 수: 1
Dimitrios
Dimitrios 2014년 10월 20일
I managed this one:
([angleofattack(1) diff(angleofattack)])/obj.timestepPerThitaNode/(1+(angleofattack(1)==1));
But any other solutions are welcome.

답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by