How to perfrorm this task using for loop and find function?

Hi, I'm new to MATLAB but there is a task I have to do but I don't know how to apporach this. I'd be grateful if you could help me.
A=[ 3, 5, -4; -8,-1, 33; -17, 6, -9]
Can anyone please explain to me how to to write a program that will create the array B by computing the natural log of the corresponding elements of an array A if the values are greater than one. The remaining elemts of B can be obtained by adding -17 to each of the corresponding elements of A.
Use a for loop with conditional statement and find function (I have to do it in two different ways)
I'll be glad if you could help me, Thanks

回答 (1 件)

Matt Kindig
Matt Kindig 2012 年 11 月 1 日

0 投票

Since this is homework, we won't provide the code, but have you looked at the help for these two functions? At the Matlab prompt, type the following:
doc find
doc for
To find the natural log, just use the log() function:
doc log

カテゴリ

ヘルプ センター および File ExchangeGet Started with MATLAB についてさらに検索

製品

質問済み:

2012 年 11 月 1 日

Community Treasure Hunt

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

Start Hunting!

Translated by