2D Matrix calculation

4 vues (au cours des 30 derniers jours)
tg295
tg295 le 29 Juin 2018
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

Réponses (1)

Star Strider
Star Strider le 29 Juin 2018
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);

Catégories

En savoir plus sur Matrices and Arrays dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by