how to make a continuity graph ?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Rahmat
am 21 Okt. 2024
Kommentiert: Rahmat
am 24 Okt. 2024
function op9_Callback(hObject, eventdata, handles)
% hObject handle to op9 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
myform=guidata(gcbo)
a=str2double(get(myform.in1,'string'));
b=str2double(get(myform.in2,'string'));
c=str2double(get(myform.in3,'string'));
d=sqrt(a^2+(b-c)^2);
e=str2double(get(myform.in4,'string'));
f=str2double(get(myform.in5,'string'));
g=str2double(get(myform.in6,'string'));
h=(4*(e-1)*(f-1)*g*10^9)/(3*10^8);
pumanlos=13.54+39.08*log10(d)+20*log10(g)-0.6*(f-1.5);
set(myform.ou3,'string',num2str(pumanlos));
i=get(handles.in8,'string')
aa=str2double(i);
j=get(handles.in9,'string')
bb=str2double(j);
k=aa:bb;
plot(handles.axes3,k,pumanlos,'o')
Result
I want to create a continuous graph from the distance that has been input, but the results are like the following, is there something wrong with my coding? please help everyone
I Just wanna like this result
Thanks.
0 Kommentare
Akzeptierte Antwort
Divyajyoti Nayak
am 21 Okt. 2024
The reason the plot from the code is not a continuous line curve but more of a scatter plot is because the y value specified in the “plot” function is a scalar (constant, as it is being calculated using “d”,”g”, and “f” which are all scalar) and the line specification ‘o’ creates circular markers instead of a line.
To fix this, the y values passed into the “plot” function should be a vector consisting of the function values at respective x-coordinate (values of “k”) and the line specifications should be ‘-’. Here’s a documentation link for the “plot” function which can help you:
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Annotations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!