MATLAB talk:Anonymous Function
Jump to navigation
Jump to search
- I'm having trouble getting my anonymous function to return a matrix of answers. Specifically, I'm working on Lab3.4.4 (EGR53 Fall, 2010) which requires that you graph A=p*k*(1+k).^n / ((1+k).^n - 1) from n = 3:50. My anonymous function is >>AnnPay = @(p, k, n) p*k*(1+k).^n/((1+k).^n - 1)<<. When I prompt AnnPay(20000, .06, 3:50) or AnnPay(20000, .06, linspace(3,50,48)), rather than return a 1x48 matrix, it returns a single answer, which does not correspond to any of the individual n-values nor to any sort of mean or median value, as far as I can tell. Thanks for your help! Mwc11 01:09, 22 September 2010 (EDT)Max (mwc11)