필터 지우기
필터 지우기

can some one help me with this code

조회 수: 1 (최근 30일)
Nasir Qazi
Nasir Qazi 2012년 3월 14일
I have problem formulating this on matlab , can someone else me to code the above picture for me cheers

답변 (1개)

Image Analyst
Image Analyst 2012년 3월 14일
I guess it's asking you to build a function. So you'd start by defining it on the function line, something like
function nextT = ComputeT(T, x_array, iterationNumber)
try
nextT = T; % Some kind of initialization
if iterationNumber == 1
% Code up left side of your flowchart.
else
% Code up right side of your flowchart.
end
catch ME
errorMessage = sprintf('Error in ComputeT().\nThe error reported by MATLAB is:\n\n%s', ME.message);
uiwait(msgbox(errorMessage));
end
return; % from ComputeT
It doesn't appear like the left or right side of your flow chart have any kind of iteration or looping so you shouldn't need a for or while loop. It looks like just straightforward step by step computation of variables with no looping. You should be able to do that yourself as it is very basic. Now it appears that there is some kind of iteration involved, but that just means that your main program that called ComputeT will have ComputeT in a for or while loop, but that main program (a test harness) was not part of your flowchart. The flowchart portion of the program just involves one single iteration number and it looks like that is an input to the process, as are the x array and "Allowable Change" parameter. I hope that gives you a good start.
  댓글 수: 4
Nasir Qazi
Nasir Qazi 2012년 3월 14일
the portion + / - confusing me , how can write this in Matlab . I know about the bit u told me , if you elaborate it in details I would appreciated that
Image Analyst
Image Analyst 2012년 3월 14일
I don't know about that part. You'd do one of these
TmPlus1 = Tm + allowableChange;
or
TmPlus1 = Tm - allowableChange;
but I don't know how you decide which one to do. You should try to ask the person who made up the flow chart.
Maybe it's not something you need to do but merely a statement that confirms that fact that TmPlus1 is within + or -allowableChange of the Tm value, which is the only way you'd get there since if it's outside of that range, you'd take a different route.

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

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by