フィルターのクリア

Doing calculation across columns

8 ビュー (過去 30 日間)
Nick DeMarchis
Nick DeMarchis 2019 年 4 月 22 日
コメント済み: Jenny Hall 2020 年 10 月 22 日
Hi there. I have a 4 column by 500 row matrix. How would I add a fifth column that calculates , where x is the corresponding value in the second column across the same row.
Thanks!

採用された回答

madhan ravi
madhan ravi 2019 年 4 月 22 日
D=zeros(500,5);
D=matrix;
D(:,5)=exp((-(matrix(:,2)-75)/2).^2)
  3 件のコメント
Stephen23
Stephen23 2020 年 10 月 22 日
編集済み: Stephen23 2020 年 10 月 22 日
x(:,2) = (((6.64e-34)*(9.5e+9))./((9.274e-24)*(x(:,1)/10000)))
% ^^ you might want array division here
Jenny Hall
Jenny Hall 2020 年 10 月 22 日
Thank you! This worked a treat.

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

その他の回答 (1 件)

JULIEN BARBAUD
JULIEN BARBAUD 2019 年 4 月 22 日
編集済み: JULIEN BARBAUD 2019 年 4 月 22 日
I think that if you call your input matrix A, and the final result B, then this:
f=@(x) exp( (-(x-75)/2).^2 )
B=[A f(A(:,2))];
should do the trick
EDIT: oops, madhan was quicker

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

タグ

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by