Effacer les filtres
Effacer les filtres

Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

generate a vector input by combining various fields

1 vue (au cours des 30 derniers jours)
Shaheer Ansari
Shaheer Ansari le 21 Sep 2020
Clôturé : MATLAB Answer Bot le 20 Août 2021
Hi all, currently i am working on lifetime prediction model of battery by utilizing multiple inputs. I have created structures of every input at each cycle individually by downsampling like voltage current temperature and capacity. But i am confused to create the vector input of each cycle by concatinating every input like [V1 C1 T1 Cap1]......[V168 C168 T168 Cap168].
I would be grateful for any assistance in this regard.
  4 commentaires
Walter Roberson
Walter Roberson le 21 Sep 2020
Look more closely at your statements
for vk=1:size(voltage,1)
for i=1:length(find(voltage(vk,:)))
D_voltage(vk).voltage(vk,i)=voltage(vk,i)
end
end
Under what circumstances do you write to D_voltage(vk).voltage(1,i) ? Other than the case where vk = 1 ?
When vk is 1, you write to voltage row 1 (only). When vk is 2, you write to voltage row 2 (only). When vk is 3, you write to voltage row 3 (only). And so on.
All of that data could be combined in a single array...
for i=1:length(find(voltage(vk,:)))
You do a find() on voltage(vk,:), so you are getting out a list of the column numbers that contain non-zero voltages. That part is potentially okay in itself. Then you take length() of that, so you know how many such entries there are. But then you increment from 1 to that length, indexing by the number, independent of whether that column contains a 0 or not. When you do this you are potentially going to be copying values that are 0 and potentially missing non-zero values.
The situation is not impossible, but for it to be valid, you would need to know that zeros only ever appear at the ends of rows, but that there might be a variable number of them.
If you do happy to want to copy to the last non-zero then I suggest
for i = 1 : find(voltage(vk,:),1,'last')
Shaheer Ansari
Shaheer Ansari le 21 Sep 2020
Thank you for the constructive suggestion Sir. I have taken a note of it and will try to implement it accordingly. furthermore, i hope if you can assist me in creating a vector by combining other parameters with voltage like [V I T Cap] for individual cycle. For eg [v1 i1 t1 cap1] [v2 i2 t2 cap2]........[v168 i168 t168 cap168].
Regards

Réponses (0)

Cette question est clôturée.

Community Treasure Hunt

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

Start Hunting!

Translated by