필터 지우기
필터 지우기

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