Basic doubt ..How to run when using function ?

1 view (last 30 days)
IPlover
IPlover on 27 May 2014
Commented: Mahdi on 27 May 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 Comment
Mahdi
Mahdi on 27 May 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.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!