Plot not appearing in the axes
Afficher commentaires plus anciens
I have this code for the callback of my button which is tasked to solve and graph. But when I try it, the plot doesn't appear in the axes. What did I do wrong?
Here's the code:
function button_Callback(hObject, eventdata, handles)
global Yo K r t Y T Y2
% hObject handle to button (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of button
Yo= str2double(get(handles.value_Yo, 'string'));
K= str2double(get(handles.value_K, 'string'));
r= str2double(get(handles.value_r, 'string'));
t= str2double(get(handles.value_t, 'string'));
Y= (K*Yo)/((K-Yo)*exp(-r*t)+Yo);
set(handles.ans, 'string', Y);
for T= 0:0.5:t;
Y= (K*Yo)/((K-Yo)*exp(-r*T)+Yo);
set(handles.axes1);
plot(T,repmat(Y,1,numel(T)),'o');
xlabel ('t(time)');
ylabel ('Y(population)')
end
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Graphics Object Properties 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!