MATLAB: I want to design a loop that gives symbolic outputs

forMATLAB

Hello every body.. I want to design a loop that gives symbolic outputs. To be more clear, If I have an expression to evaluated through the loop and I need to get the evaluated expression in terms of say, x, what should I do in order to accomplish this? ex: m = [1 2 3 4 5] for i =1:5; f(i) = m(i)*x+1; end Now i need to get the outputs as f(1)= m(1)*x+1,…,etc. Thanks in advance

Best Answer

>> syms x
>> f = (1:5)'*x - 1