2D Matrix calculation

5 ビュー (過去 30 日間)
tg295
tg295 2018 年 6 月 29 日
回答済み: Star Strider 2018 年 6 月 29 日
Hi there,
Fairly new to neuron.
If A is a 1000x1 vector containing non-integer values,
B is a 1000x1 vector also containing non-integer values,
and x is a vector containing integers from 1-36
How would I best go about calculating the following 1000x36 matrix,C:
C(A,B,x) = A/x + B/x
Fyi A and B are changing in time, and values of x are points in space (along an x-axis). So im wanting to see how the values at each point in space are changing over time, with 1000 time samples.
So maybe it should be written like this instead:
C(t,x) = A(t)/x + B(t)/x
Many thanks

回答 (1 件)

Star Strider
Star Strider 2018 年 6 月 29 日
I would use bsxfun.
These produce the same result:
C1 = bsxfun(@mrdivide, A, x) + bsxfun(@mrdivide, B, x);
C2 = bsxfun(@rdivide, A, x) + bsxfun(@rdivide, B, x);

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by