how to make a continuity graph ?
11 views (last 30 days)
Show older comments
Rahmat
on 21 Oct 2024
Commented: Rahmat
on 24 Oct 2024 at 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.
0 Comments
Accepted Answer
Divyajyoti Nayak
on 21 Oct 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:
More Answers (0)
See Also
Categories
Find more on Annotations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!