get circuit (simulink electrical) output in matlab code
이전 댓글 표시
Hello. I have drawn a simple circuit (RLC with sinusoidal input) using electrical simulink.

I have two questions. How can I read circuit output for example resistor voltage and plot it in matlab code? (I know that we can use Sim command to call simulink models in a matlab code). And how can I modify the circuit (simulink model) in the code, for example change the voltage source frequency or add a new element at specific nodes? Many thanks for your time.
답변 (1개)
Ameer Hamza
2020년 4월 19일
See the attached file (saved in R2020a) to see an example of reading the voltage and plotting it in MATLAB. Run the following code to plot the value
sim('sim_model');
plot(out.r_voltage)
댓글 수: 4
Ameer Hamza
2020년 4월 19일
Mr Noone, check the updated answer. The file is attached.
Mr Noone
2020년 4월 19일
Ameer Hamza
2020년 4월 19일
Glad to be of help.
카테고리
도움말 센터 및 File Exchange에서 Simscape Electrical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!