Variable output as "1x0 empty double row vector" halfway through the program after previous iterations in the for loop has normal output values for the same variables.

4 visualizaciones (últimos 30 días)
Why am I getting 1x0 empty double row vectors for the last several iterations of the variables Peaks and X_Peak_value? The output seems to produce values for these variables up to a point and then the output only displays "1x0 empty double row vector".
Here is my code...
clear all;clc
Data = InputData('CJ1');
Unrecognized function or variable 'InputData'.
for i = 1:1:90
for x = 1:1:900
vel = 0;
vel = vel + 1*x;
alt = 0;
alt = alt + 500*i;
R = aerodynamics(vel, alt,Data);
V(x) = vel;
RC(x) = R.RC;
end
[Peaks, X_Peak_value] = findpeaks(RC, V)
ROC_max(i)= Peaks;
Vel_max_ROC(i) = X_Peak_value;
end
plot(Vel_max_ROC, ROC_max)

Respuestas (2)

Cris LaPierre
Cris LaPierre el 9 de Mayo de 2023
We can't run your code to explore why specifically, but my guess is that they are empty because findpeaks did not identify any peaks in your input RC.

Torsten
Torsten el 9 de Mayo de 2023
Movida: Torsten el 9 de Mayo de 2023
It may happen that no peaks can be found:
RC = 1:4;
V = 1:4;
[Peaks, X_Peak_value] = findpeaks(RC, V)
Peaks = 1×0 empty double row vector X_Peak_value = 1×0 empty double row vector

Community Treasure Hunt

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

Start Hunting!

Translated by