Function Handle Not Reading the Input I want Evaluated
이전 댓글 표시
Here is my code, I am having an issue with the function handle not reading the array defined for thplot. I am trying to get the inital plot of the function to make an estimated guess to evaluate my function at the built in fzeros function.
The error just says
error in line "fplot=f(thplot);"
why is it not able to evaluate the function f @ thplot?
%Feilder Throwing Ball to Catcher
%Define the function who's zeros we're looking for
format longthrew
Vo=30; % velocity initial in m/s
y=-.8; %Final height of the ball after throw (1.8m start to 1m finish)
x=90; %Distance the fielder threw the ball
g=9.81;%gravity
f= @(th) x*tan(th*pi/180)-(g*x^2/(2*Vo^2*(cos(th*pi/180)^2)))+y;
%plot the function to get idea for initial guess
thplot=[0:70];
fplot=f(thplot);
plot(thplot, fplot, 'b', thplot, fplot*0, 'r--')
xlabel('theta');
legend ('fplot', 'y=0');
xlabel(theta);
legend('F(theta)', 'y=0');
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!