Network drop Graph in Matlab

3 Ansichten (letzte 30 Tage)
Vartika Agarwal
Vartika Agarwal am 5 Mai 2022
Beantwortet: BhaTTa am 11 Mär. 2025
I want to plot a graph like this in Matlab
How we can do this ?
  7 Kommentare
Geoff Hayes
Geoff Hayes am 9 Mai 2022
@Vartika Agarwal - to be clear, the "data" you have is just the attached picture?
Vartika Agarwal
Vartika Agarwal am 10 Mai 2022
X= [73,77,81,85,89,93,100]
y= [1,2,3]
Network drop at 81 and after 85 network will work continuously.
I hope you understand my point and your help will be really appreciated.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

BhaTTa
BhaTTa am 11 Mär. 2025
Hey @Vartika Agarwal, To visually represent the network drop as a falling line at X = 81, you can add a vertical line that drops from the interpolated Y value at 81 to a lower Y value. Refer to MATLAB script below and take it as a reference and modify it accordingly:
% Define the data
X = [73, 77, 81, 85, 89, 93, 100];
Y = [1, 2, 3];
% Assuming Y values need to be repeated or interpolated for X values
% Example: Linear interpolation
Y_interp = interp1([73, 100], [1, 3], X, 'linear');
% Plot the data
figure;
plot(X, Y_interp, 'b-o'); % Plot with blue line and circle markers
hold on;
% Highlight the network drop at 81
% Interpolated Y value at 81
Y_drop_start = Y_interp(3);
% Define the drop to a lower Y value, e.g., 0.5
Y_drop_end = 0.5;
% Plot the falling line to represent the drop
plot([81, 81], [Y_drop_start, Y_drop_end], 'r--', 'LineWidth', 2); % Red dashed line
% Add labels and title
xlabel('X-axis');
ylabel('Y-axis');
title('Increasing Slope with Network Drop');
% Add legend
legend('Network Data', 'Network Drop at 81');
% Display grid
grid on;
% Hold off to stop adding to the plot
hold off;

Kategorien

Mehr zu Networks finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by