Multiply matrix column by an equation

2 Ansichten (letzte 30 Tage)
Sabrina Fleming
Sabrina Fleming am 10 Nov. 2021
Beantwortet: Fangjun Jiang am 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.

Akzeptierte Antwort

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

Weitere Antworten (0)

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by