I would like to calculate the Energy for 3 days values.
1 次查看(过去 30 天)
显示 更早的评论
By using this formula how i can build in simulink, i have the values of P in excel file we need to load first after that need to calculate the energy in simulink.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/150288/image.jpeg)
0 个评论
回答(1 个)
Sebastian Castro
2015-5-19
Luckily, your Excel data is formatted ready for loading into Simulink.
First, you can read the data into MATLAB using the xlsread function. Then, you can split the data into the time and the energy:
data = xlsread('Book1.xlsx');
t = data(:,2);
energy = data(:,1);
plot(t,energy) % Just to double-check
Then, make a new Simulink model with an input port and an Integrator block to integrate your signal. You can bring the data you just loaded into Simulink by going to Simulation > Model Configuration Parameters > Data Import/Export . There, check the Load from workspace > Input option and enter the time and energy as [t,energy].
- Sebastian
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Sources 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!