How do I use an anonymous function
I've set the following:
x = 1:100
a = [1,5,2.5]
gau = @(x)@(x)(a(1).*exp(-0.5.*((x-a(2)).^2./a(3).^2)))
this works fine. but now I want to pass the 'a' parameters, so tried
c = @(g) (@(x),a), but this does not work
Ideas?

답변 (2개)

Jeff Miller
Jeff Miller 2018년 2월 23일

1 개 추천

x = 1:100;
a = [1,5,2.5];
gau = @(x,a)(a(1).*exp(-0.5.*((x-a(2)).^2./a(3).^2)));
m1 = gau(x,a)
Derrick Salmon
Derrick Salmon 2018년 2월 23일

0 개 추천

Ahh - works perfectly - thanks for the help

카테고리

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

질문:

2018년 2월 23일

답변:

2018년 2월 23일

Community Treasure Hunt

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

Start Hunting!

Translated by