hello everyone, Im trying to disply the values of max, min and average of the relative error in the graph
A= matrix 20x2
V_interpolation = matrix 20x1
V_exper = -A(:,2);
r_exper = A(:,1);
Absuolut_Error = -abs(V_interpolation - V_exper);
Relative_Error = -abs(Absuolut_Error/(V_exper))
Max= max(Relative_Error);
Min= min(Relative_Error);
Average = mean(Relative_Error);

 Réponse acceptée

Image Analyst
Image Analyst le 14 Déc 2019

1 vote

Use plot() if you want to indicate with a marker. Use yline() or line() if you want to draw a line from the axis. Use sprintf() and text() if you want to put text onto the graph.

4 commentaires

thank you for your response, but how will it be done as a marker or to put text into graph. if you don't mind showing me exmple. Im very new to matlab.
thanks
Image Analyst
Image Analyst le 15 Déc 2019
Modifié(e) : Image Analyst le 15 Déc 2019
Try this:
% Create data
period = 250;
sigma = 250;
x = linspace(-500, 500, 1000);
attenuationSignal = exp(-(x - 75).^2/sigma^2);
y = sin(2 * pi * x / period) .* attenuationSignal;
% Plot data
plot(x, y, 'b-', 'LineWidth', 2);
grid on;
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0, 0.04, 1, 0.96]);
% Find the max
[yMax, indexAtMax] = max(y);
xMax = x(indexAtMax)
% Plot a red marker there
hold on;
plot(xMax, yMax, 'rv', 'LineWidth', 2, 'MarkerSize', 15);
ylim([-1, 1.2]);
% Put a horizontal line from left side to max
yl = ylim; % Get range of plot.
xl = xlim; % Get range of plot.
line([xl(1), xMax], [yMax, yMax], 'Color', 'r', 'LineWidth', 2);
% Put a vertical line from bottom side to max
line([xMax, xMax], [yl(1), yMax], 'Color', 'r', 'LineWidth', 2);
% Add axis labels.
fontSize = 20
xlabel('x', 'FontSize', fontSize);
ylabel('y', 'FontSize', fontSize);
title('Demo for Amjad by Image Analyst', 'FontSize', fontSize);
If it works and we're done, then can you "Accept this answer"? Thanks in advance.
well done thank you so much I reall appreicated your hlep
Thank you my friend.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Line Plots dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by