Multiply matrix column by an equation

2 vues (au cours des 30 derniers jours)
Sabrina Fleming
Sabrina Fleming le 10 Nov 2021
I used A= readmatrix() to create a very large matrix from data in an excel file and now have:
[x1 z1
x2 z2
x3 z3 ] etc.
I'd like to take all the current "x" values in column 1 and apply the funtion y=ln(1+x) and create a new matrix with:
[y1 z1
y2 z2
y3 z3] etc.
I tried using a for loop, but didn't know how to input the existing x values into the function.
Any advice welcome, please let me know if you'd like more info.

Réponse acceptée

Fangjun Jiang
Fangjun Jiang le 10 Nov 2021
A=[1:3;10:10:30]'
A(:,1)=log(A(:,1)+1)

Plus de réponses (0)

Catégories

En savoir plus sur Shifting and Sorting Matrices 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