Whats wrong with my code?
Afficher commentaires plus anciens
All I wanna do is plot a user input function. What's wrong with this? I'm new to function handles. So any extra tips would be great too!!!
if true
% code
F = input('Enter a function in terms of x: y= ', 's');
disp('Your function is');
disp(F);
fh = @(x)str2func(F);
d1 = input('Lower domain limit: ');
d2 = input('Upper domain limit: ');
x = linspace(d1-(d2-d1)*.15,d2+(d2-d1)*.15,1000); %15 percent out of domain
y = fh(x);
plot(x,y);
end
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Financial Toolbox dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!