how to make a continuity graph ?
13 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
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:
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!