Basic doubt ..How to run when using function ?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentar
Mahdi
am 27 Mai 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.
Antworten (0)
Siehe auch
Kategorien
Mehr zu Subplots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!