I need a plot between positive minima of given Ra_ and given xi in matlab.
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
xi = 0.1:0.01:0.5;
Ra_ =
1.0e+06 *
Columns 1 through 15
-9.0002 -5.0872 -1.4181 -1.3406 -1.1055 -0.7351 -0.4909 -0.5023 -0.2831 -0.2212 -0.0893 -0.0521 -0.0394 -0.0313 0.0512
Columns 16 through 30
-0.0218 -0.0118 0.0295 0.0221 -0.0119 -0.0097 -0.0073 0.0058 0.0055 -0.0021 0.0022 0.0022 0.0020 0.0008 0.0007
Columns 31 through 45
0.0001 0.0001 -Inf -Inf Inf Inf Inf Inf -Inf Inf Inf Inf Inf Inf Inf
Columns 46 through 60
Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf
Columns 61 through 75
Inf Inf Inf Inf 5.4252 0.2024 5.4252 0.2024 -Inf -Inf Inf Inf 8.2399 8.2399 0.3067
Columns 76 through 80
0.3067 -Inf -Inf Inf Inf
I need a plot between positive minima of given Ra_ and given xi in matlab.
Thanks in advance.
1 commentaire
Dyuman Joshi
le 13 Déc 2023
Dimensions of Ra_ and xi do not match for plotting.
Also, post the data, not the output given by MATLAB for the data.
Réponses (1)
SAI SRUJAN
le 21 Déc 2023
Hi Madhvi,
I understand that you are trying to plot the positive minima of given 'Ra_' and the given 'xi' in MATLAB.
You need to ensure that the dimensions of 'xi' and 'Ra_' match. According to the provided output, 'xi' ranges from 0.1 to 0.5 with a step of 0.01, which suggests there should be 41 elements in 'xi'. However, the 'Ra_' array provided has 80 elements.Without the actual data, I am assuming that each element in 'xi' corresponds to an element in 'Ra_'. If this is not the case, you'll need to adjust your data accordingly.
To find the positive minima of 'Ra_', you can use MATLAB's built-in functions like 'isfinite' to ignore Inf, -Inf, and NaN values, and then find the minimum positive value. You can follow the given example to proceed further,
% Remove non-finite values
finiteRa = Ra_(isfinite(Ra_));
% Find local minima
[Minima, MinIdx] = findpeaks(-finiteRa);
Minima = -Minima; % Correct the sign since we used -Ra_ to find minima
% Filter only positive minima
positiveMinima = Minima(Minima > 0);
positiveMinIdx = MinIdx(Minima > 0);
% Get corresponding xi values
positiveMinXi = xi(positiveMinIdx);
% Plot the positive minima against xi
figure;
plot(positiveMinXi, positiveMinima, 'o');
xlabel('xi');
ylabel('Positive Minima of Ra_');
title('Plot of Positive Minima of Ra_ vs. xi');
In this code, 'plot' is used to create the line graph of 'Ra_' versus 'xi', and the positive minimum is marked with a circle using 'o'. Make sure to replace the placeholders for 'xi' and 'Ra_' with the actual data arrays.If the dimensions of 'xi' and 'Ra_' do not match, you will need to correct this before plotting.
For a comprehensive understanding of the "findpeaks" and "isfinite" function in MATLAB, please refer to the following documentation.
I hope this helps.
2 commentaires
Voir également
Catégories
En savoir plus sur Annotations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!