Filtering through multiple vectors for a single set of values
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
I get the roots below using an equation solver & filtering out "unrealistic" roots with conditional/logical statements.
The part I'm stuck on is on how to code this proccess:
1) Identify the common integer at the beginning of the vector sets between Q1 - Q6 (in this case, 3)
2) Filter out the other vector sets (2,4)
3) Pull out the long decimal number from the #3 vector sets & assign that as the new Q1 Q2 etc
Q1 =
[ 2, 1, 1, 0.058437210716851634542028894189494]
[ 3, 1, 1, 0.058688566689220710419984397081727]
Q2 =
[ 2, 1, 1, 0.0098069127074167821263054682858129]
[ 3, 1, 1, 0.0078508603596354954926620927235173]
Q3 =
[ 2, 1, 1, 0.0015627892831483654579711058105059]
[ 3, 1, 1, 0.0013114333107792895800156029182727]
Q4 =
[ 2, 1, 1, 0.041562789283148365457971105810506]
[ 3, 1, 1, 0.041311433310779289580015602918273]
Q5 =
[ 3, 1, 1, 0.00083770632958521492732230435821]
[ 4, 1, 1, 0.020473081482478049769416844651268]
Q6 =
[ 3, 1, 1, 0.01083770632958521492732230435821]
[ 4, 1, 1, 0.030473081482478049769416844651268]
2 comentarios
Jacob Wood
el 26 de Feb. de 2020
Will there always be a single integer that appears once in every Q_i?
Respuestas (2)
KSSV
el 26 de Feb. de 2020
1) Identify the common integer at the beginning of the vector sets between Q1 - Q6 (in this case, 3)
Read about unique for this.
2) Filter out the other vector sets (2,4)
Use ismember for this.
3) Pull out the long decimal number from the #3 vector sets & assign that as the new Q1 Q2 etc
You can use logical indexing for this.
0 comentarios
Jacob Wood
el 26 de Feb. de 2020
Editada: Jacob Wood
el 26 de Feb. de 2020
Chad,
This might be a solution for you. It picks the most common root label and grabs all of them:
Q1 = [ 2, 1, 1, 0.058437210716851634542028894189494;
3, 1, 1, 0.058688566689220710419984397081727];
Q2 = [ 2, 1, 1, 0.0098069127074167821263054682858129;
3, 1, 1, 0.0078508603596354954926620927235173];
Q3 = [ 2, 1, 1, 0.0015627892831483654579711058105059;
3, 1, 1, 0.0013114333107792895800156029182727];
Q4 = [ 2, 1, 1, 0.041562789283148365457971105810506;
3, 1, 1, 0.041311433310779289580015602918273];
Q5 = [ 3, 1, 1, 0.00083770632958521492732230435821;
4, 1, 1, 0.020473081482478049769416844651268];
Q6 = [ 3, 1, 1, 0.01083770632958521492732230435821;
4, 1, 1, 0.030473081482478049769416844651268];
Q = [Q1;Q2;Q3;Q4;Q5;Q6];
select_int = mode(Q(:,1));
roots = Q(Q(:,1)==select_int,4);
3 comentarios
Jacob Wood
el 26 de Feb. de 2020
I'm not sure I'm following. What is happening in these lines? Is this output from running the code?
[ 2, 0.058437210716851634542028894189494]
[ 3, 0.058688566689220710419984397081727]
Ver también
Categorías
Más información sobre Filter Analysis 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!