Develop GUI using accelerometer sensor in mobile phone to collect data, filter signal, and show peaks in the signal on the mobile phone

3 visualizaciones (últimos 30 días)
I am facing these errors when i try to run
=== Simulation (Elapsed: 4 sec) ===
Error:Index expression out of bounds. Attempted to access element 3. The valid range is 1-1.
More information
Function 'MATLAB Function2' (#109.51.52), line 3, column 20:
"3"
Launch diagnostic report.
Error:Undefined function or variable 'z'. The first assignment to a local variable determines its class.
Function 'MATLAB Function2' (#109.196.197), line 10, column 30:
"z"
Launch diagnostic report.
Error:Errors occurred during parsing of MATLAB function 'john4/MATLAB Function2'
Error:Simulink cannot determine sizes and/or types of the outputs for block 'john4/MATLAB Function2' due to errors in the block body, or limitations of the underlying analysis. The errors might be inaccurate. Fix the indicated errors, or explicitly specify sizes and/or types for all block outputs.
Error:Simulink cannot determine sizes and/or types of the outputs for block 'john4/MATLAB Function2' due to errors in the block body, or limitations of the underlying analysis. The errors might be inaccurate. Fix the indicated errors, or explicitly specify sizes and/or types for all block outputs.
Error:Port width mismatch. Input 'Acceleration' expects a signal of size 1. The signal received is of size [1x1].
run the build on my mobile phone,

Respuestas (1)

Walter Roberson
Walter Roberson el 12 de Mzo. de 2023
You have the Android X Y Z sensors. You extract Z from that -- a scalar. You have the Android button sensor. You extract status (pushed or not) from that -- a scalar. You multiply the scalar Z by the scalar button status, getting a scalar out. You pass that to Accleration function which does
function b = fcn(Acceleration)
z = Acceleration(:,3);
However the input is the scalar, z times button state, rather than being something with three columns.
b = filter(sgolay_coeffs, 1, z);
You have a scalar z, not a history of z. Applying a filter to a scalar is not going to do much good.

Categorías

Más información sobre Modeling en Help Center y File Exchange.

Productos


Versión

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by