Could someone please explain what is wrong in this simple code

Could someone please explain what is wrong in this simple code
cm=@(x,t) exp((-x^2)/(4*Dt))/2*(pi*Dt)^(1/2);
for Dt=[1/16,1/4,1]
for x=-5:.01:5
hold on
plot(x,cm)
end
or
cm=inline('exp((-x^2)/(4*Dt))/2*(pi*Dt)^(1/2)','x','Dt');
for Dt=[1/16,1/4,1]
hold on
fplot(@(x) cm,[-5,5])
end
it doesn't work either way. tnx
end

 채택된 답변

James Tursa
James Tursa 2016년 11월 7일
Is this what you want?
cm = @(x,Dt) exp((-x.^2)/(4*Dt))/2*(pi*Dt)^(1/2);
Dt = [1/16,1/4,1];
x = -5:.01:5;
for k=1:numel(Dt)
plot(x,cm(x,Dt(k)))
hold on
end

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Interpolation에 대해 자세히 알아보기

질문:

k s
2016년 11월 7일

댓글:

k s
2016년 11월 8일

Community Treasure Hunt

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

Start Hunting!

Translated by