Hello, I am trying to visualize/plot a standard gaussian fit [a*exp(-((x)/c)^2)] with a known value for c. In this case, it should be fine if a=1.
I am having trouble plotting this since I do not have coordinate pairs to make the graph. I would prefer using a code to do this rather than the curve fitting toolbox if possible because I want to visualize multiple curves at once. Thank you so much for your help!

 채택된 답변

Star Strider
Star Strider 2018년 1월 18일

0 개 추천

Try this:
gaussfcn = @(b,x) b(1).*exp(-((x)./b(2)).^2);
xv = linspace(-10, 10);
b = [1; 4.2];
yv = gaussfcn(b, xv);
figure(1)
plot(xv, gaussfcn(b, xv))
grid

댓글 수: 4

Emily Pendleton
Emily Pendleton 2018년 1월 18일
편집: Emily Pendleton 2018년 1월 18일
where in this equation can I put in my value for sigma? In one instance, sigma = 0.69232
The sigma value would be ‘b(2)’:
gaussfcn = @(b,x) b(1).*exp(-((x)./b(2)).^2);
xv = linspace(-3, 3);
b = [1; 0.69232];
yv = gaussfcn(b, xv);
figure(1)
plot(xv, gaussfcn(b, xv))
grid
Emily Pendleton
Emily Pendleton 2018년 1월 19일
thank you!
Star Strider
Star Strider 2018년 1월 19일
As always, my pleasure!

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

추가 답변 (0개)

카테고리

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

질문:

2018년 1월 18일

댓글:

2018년 1월 19일

Community Treasure Hunt

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

Start Hunting!

Translated by