Subtract function from array
    4 次查看(过去 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!


