フィルターのクリア

3D Gaussian Decay from 1 to 0

1 回表示 (過去 30 日間)
Inês Rodrigues
Inês Rodrigues 2015 年 5 月 26 日
コメント済み: Inês Rodrigues 2015 年 5 月 26 日
I'm doing a model in matlab and I want that, when my variable k is 1, it decays to 0 by a gaussian pattern. It's a 3D model, so the maximum 1 would decay in every direction. The result would be a matrix with the ones k gave me and the other elements between 0 and 1. Could you please help me?

採用された回答

Image Analyst
Image Analyst 2015 年 5 月 26 日
編集済み: Image Analyst 2015 年 5 月 26 日
If you have the Image Processing Toolbox, you can use fspecial(). Of course since it's Gaussian, it will decay towards zero, not to zero. Gaussians can never equal zero.
If you don't have that toolbox, just use meshgrid() and exp() to create the Gaussian pattern. In fact, this might be easier for the 3D case since with fspecial, it just creates a 2D Gaussian so you'd have to call it repeatedly to get the third dimension of a 3D Gaussian "ball".
  3 件のコメント
Image Analyst
Image Analyst 2015 年 5 月 26 日
Of course, just use x - xCenter. The usual offset formula like for all mathematical formula like you're used to. But you're not creating a 3D matrix, you're creating a 2D one. Just look - 2 indexes. That means it's 2D. If it were 3D, you'd have to have 3 indexes, one for x, one for y, and one for z.
Inês Rodrigues
Inês Rodrigues 2015 年 5 月 26 日
Thank you!

サインインしてコメントする。

その他の回答 (0 件)

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by