how to make a continuity graph ?

13 次查看(过去 30 天)
Rahmat
Rahmat 2024-10-21,7:46
评论: Rahmat 2024-10-24,1:36
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.

采纳的回答

Divyajyoti Nayak
Divyajyoti Nayak 2024-10-21,9:32
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:
  1 个评论
Rahmat
Rahmat 2024-10-24,1:36
The problem has been found, thank you very much for your help.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Annotations 的更多信息

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by