MATLAB: Entering a formula by user beginnerMATLAB Is there a function which allows me to ask for a formula, while the prgram is beeing used, and subsequently use that formula? Best Answer Have a look at eval: http://www.mathworks.com/help/techdoc/ref/eval.htmlaMatrix = magic(5);expression = input('Enter the name of a matrix: ','s');if (exist(expression,'var')) mesh(eval(expression))end Related SolutionsMATLAB: Help on entering velocity formula Try this:fontSize = 20;t = linspace(-3*pi, 3*pi, 800);v= pi *exp(-0.25*t) .* cos(pi*t) - 0.25 .* exp(-0.25*t) .* sin(pi*t);plot(t, v, 'b-', 'Linewidth', 3);grid on;xlabel('t', 'FontSize', fontSize);ylabel('v', 'FontSize', fontSize); MATLAB: User input to change the name of an existing variable https://www.mathworks.com/matlabcentral/answers/304528-tutorial-why-variables-should-not-be-named-dynamically-evalhttps://www.mathworks.com/help/matlab/matlab_prog/string-evaluation.html Related QuestionConversion formulaHow to change struct name in a loopI could use some help entering this formula into matlab.Solving a formula in MatlabAssigning input string as variable name
Best Answer