Graphing a user input function between limits

1 view (last 30 days)
So what I'm trying to do is plot the user input function between the two plots (pltA and pltB) as number of times determined by the numberofplots input by user. With what I have now it does indeed calculate all the values of y and x between A and B for the default number of iterations (100) but when it plots them it only plots the first value and continues on with the program. Any ideas?
pltA = get(handles.txtA,'String');
pltA = str2num(pltA);
pltB = get(handles.txtB,'String');
pltB = str2num(pltB);
numberofplots = get(handles.txtPlot,'String');
numberofplots = str2num(numberofplots);
intIndex = (pltB - pltA) / numberofplots
intplotiteration = 1
strX = pltA
while abs(intplotiteration) <= numberofplots
strX = strX
sngX = num2str(strX)
sngX = ['(' sngX ')']
strFx = strrep(strEquation,'x',sngX)
sngPlot = eval(strFx)
intIndex = pltA + intIndex
intplotiteration = intplotiteration + 1
plot(strX,sngPlot)
hold all
end

Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!