フィルターのクリア

I need a plot between positive minima of given Ra_ and given xi in matlab.

1 回表示 (過去 30 日間)
MADHVI
MADHVI 2023 年 12 月 13 日
コメント済み: SAI SRUJAN 2023 年 12 月 28 日
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 件のコメント
Dyuman Joshi
Dyuman Joshi 2023 年 12 月 13 日
Dimensions of Ra_ and xi do not match for plotting.
Also, post the data, not the output given by MATLAB for the data.

サインインしてコメントする。

回答 (1 件)

SAI SRUJAN
SAI SRUJAN 2023 年 12 月 21 日
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 件のコメント
MADHVI
MADHVI 2023 年 12 月 22 日
Thanks for your help. The issue has been resolved.
SAI SRUJAN
SAI SRUJAN 2023 年 12 月 28 日
Hi @MADHVI, glad to know that this worked for you!

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by