can some one help me with this code

3 visualizaciones (últimos 30 días)
Nasir Qazi
Nasir Qazi el 14 de Mzo. de 2012
I have problem formulating this on matlab , can someone else me to code the above picture for me cheers

Respuestas (1)

Image Analyst
Image Analyst el 14 de Mzo. de 2012
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 comentarios
Nasir Qazi
Nasir Qazi el 14 de Mzo. de 2012
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 el 14 de Mzo. de 2012
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.

Iniciar sesión para comentar.

Categorías

Más información sobre Data Preprocessing en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by