how to make a continuity graph ?

8 ビュー (過去 30 日間)
Rahmat
Rahmat 2024 年 10 月 21 日
コメント済み: Rahmat 2024 年 10 月 24 日
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 日
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 日
The problem has been found, thank you very much for your help.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by