0

I've got this problem to solve for a very long time,and unfortunately ,still couldn't find a proper answer for it.and here is the problem: I have this piece of code which is producing a string with 'syms' function and requesting from user to enter his/her desired function in 'x(i)' form:

start=input('Enter Starting Point In A Vector Form:\n');
N = input('How many variables Your Function Has?\n');
strArray = [ repmat('x',N,1) dec2base(1:N,10) repmat(' ',N,1)]; % create strings
strArray = strvcat(regexprep(mat2cell(strArray, ...
  ones(1,size(strArray,1)), size(strArray,2)),'x0+','x')).'; % remove heading 0's
str = ['syms ' strArray(:).']; % string to be evaluated
display(str);
eval(str);
f=input('Enter Your Desired Function In The Form Of x(i) Variables;eg:x1^2 etc:\n');

Now,I want to assign the 'start' vector to this symbolic function 'f'.how can i do so?

MR Meyqani
  • 25
  • 7

0 Answers0