フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Matlab Help on for loops

1 回表示 (過去 30 日間)
Steve
Steve 2011 年 10 月 24 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
Hi, i'm getting started with matlab and I had a fairly simple question. I have an equation with two changing variables x and y while everything else remains constant. x and y are called from a seperate text files by:
data = load('hat.txt.'), x = data(:,1), y = data(:,2)
I want to put these two variables in this equation and output a column of values for every changing value of x and y. How would I go about doing this?
C= (0.1+(x*(y+2)))

回答 (1 件)

Rick Rosson
Rick Rosson 2011 年 10 月 24 日
No need for a loop. Please try the following:
C = (0.1+(x.*(y+2)));
Notice the use of the .* operator, which signifies element-by-element multiplication.
HTH.
Rick

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by