Storing Data and working out an equation

2 visualizaciones (últimos 30 días)
Sam Butler
Sam Butler el 20 de Mzo. de 2023
Respondida: David Hill el 20 de Mzo. de 2023
Hi, I am quite new to MATLAB so this may be simple.
I have two variables called Filtered_Gear_rpm and Filtered_NES_rpm that have data in each that make up an array of 40000x1 (for each variable). I have data over a time period of 5 seconds.
The aim is to extract data from each variable between 2 and 3 seconds (16,000th element to 24,000th element) and input each data point into an equation (that contains both Filtered_Gear_rpm and Filtered_NES_rpm) which will then store these values in an array or matrix.
The equation contains both Filtered_Gear_rpm and Filtered_NES_rpm so i presume these will have to be in the same loop.
I have tried using a for loop but I have got no where with it however I think this is the right idea.

Respuestas (1)

David Hill
David Hill el 20 de Mzo. de 2023
Just index, no loop needed.
Filtered_Gear_rpm=rand(40000,1);%sample data
Filtered_NES_rpm=rand(40000,1);%sample data
x=Filtered_Gear_rpm(16000:24000);
y=Filtered_NES_rpm(16000:24000);
z=exp(x).*exp(y)+log(x).*log(y)%whatever you equation is
z = 8001×1
2.9771 4.1597 4.9747 3.1445 4.2159 3.1354 3.5721 4.0972 3.0583 3.2426

Categorías

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

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by