Converting flowchart to matlab code

조회 수: 3 (최근 30일)
menaka malu
menaka malu 2020년 2월 18일
답변: Vishal Sharma 2022년 5월 14일
I have one flow chart with me regarding my work. Iam trying to convert the flowchart to matlab code. But iam facing some difficulties in loops. one loop is there for time increment. Time is starting from 0. And incrementing 0.0025s in each iteration. But end value of time is infinity. The end time is deciding by condition. Is x<y means iteration has to stop. how i will put the loop with while condition?

채택된 답변

KSSV
KSSV 2020년 2월 18일
x = 0 ; % your initial x value
y = 100 ; % your fixed y value
t0 = 0 ; % initial time
dt = 0.00025 ; % time step
t = zeros([],1) ; % initilaize the time array
count = 0 ;
while x < y
count = count+1;
t(count) = t0+(count-1)*dt ;
% calculate x
x = rand*100+rand ; % this is for demo
end
  댓글 수: 1
menaka malu
menaka malu 2020년 2월 22일
Thankyou for trying this. I will try this way

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Vishal Sharma
Vishal Sharma 2022년 5월 14일
Can anyone please provide the MATLAB code for the given flowchart

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by