Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
generate a vector input by combining various fields
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Walter Roberson
am 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')
Antworten (0)
Diese Frage ist geschlossen.
Siehe auch
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!