필터 지우기
필터 지우기

Basic doubt ..How to run when using function ?

조회 수: 2 (최근 30일)
IPlover
IPlover 2014년 5월 27일
댓글: Mahdi 2014년 5월 27일
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
Mahdi
Mahdi 2014년 5월 27일
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.

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

답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by