Subtract function from array
조회 수: 6 (최근 30일)
이전 댓글 표시
Hi, I have a list of x/y coordinates. Is there an easy way to subtract a function (y = f(x)) from all y data? Thanks a lot!
Jacob
댓글 수: 0
채택된 답변
Jan
2011년 12월 13일
Isn't this trivial?
f = @cos;
x = linspace(0, 2*pi, 100);
y = sin(x);
y2 = y - f(x);
or any other function instead of cos as long as it replies a vector with the same dimensions as the input.
댓글 수: 0
추가 답변 (2개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!