Borrar filtros
Borrar filtros

Basic doubt ..How to run when using function ?

2 visualizaciones (últimos 30 días)
IPlover
IPlover el 27 de Mayo de 2014
Comentada: Mahdi el 27 de Mayo de 2014
I am writing euler lagrange function for minimization. I always have a problem running the code when i use functions.
When i press run it tells"Type code to run" What should i do ?
Here is my code
function [u] = heat (f)
subplot(121);
imagesc(f); title('Original'); colormap gray;
dt = 0.01;
T = 5;
u = f;
[m,n] = size(u);
for t = 0:dt:T
u_xx = ( u(:,[2:n,n]) - 2*u + u(:,[1,1:n-1]) ) / 2;
u_yy = ( u([2:m,m],:) - 2*u + u([1,1:m-1],:) ) /2;
u = u + dt*( u_xx + u_yy);
subplot(122);
imagesc(u); title(['t=',num2str(t)]); pause(0.1);
end;
end
  1 comentario
Mahdi
Mahdi el 27 de Mayo de 2014
You defined it as a function, so are you calling an input into the function from the command window, such as:
heat(f) % Where I presume f is an "image" matrix.

Iniciar sesión para comentar.

Respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by