How to convert matlab file into a voltage signal in simulink

조회 수: 1 (최근 30일)
Saurabh Sakpal
Saurabh Sakpal 2014년 12월 18일
답변: Saurabh Sakpal 2014년 12월 19일
Hi, I have a code where it is a sin wave for first 0.6 seconds and 0 for the next 0.4 seconds. Which i have created using if statements etc. so its a matlab file. Now thing is i want to generate this as a voltage supply, how do i import this matlab file into the voltage supply. I know there is a 'from workspace' and 'from file' function. but i have no idea how to use this. thanks.

채택된 답변

Orion
Orion 2014년 12월 18일
And here comes the debug problems :).
so what you need to do is :
  댓글 수: 6
Orion
Orion 2014년 12월 18일
Fine, so you can close this question.

댓글을 달려면 로그인하십시오.

추가 답변 (4개)

Orion
Orion 2014년 12월 18일
I already answered you in your previous post, it's a best practice to do it directly with Simulink blocks.
But if you insist to use directly an external mfile, you need to use another block : interpreted matlab function
  댓글 수: 3
Orion
Orion 2014년 12월 18일
편집: Orion 2014년 12월 18일
And best practice, because calling external files often creates some debugging problems.
Saurabh Sakpal
Saurabh Sakpal 2014년 12월 18일
also does that matlab file have to be a function or a file? And also do i have to specify the time during which it ran in that function? What do i put into the integrated maths function aargh i am so confused? can u show me how to do it?
heres my code
t = 0:0.05:1; %#ok<*NBRAK> a = size(t);
y = zeros(1,a);
i=1; for t = 0:0.05:1
if t<0.6
y(i) = sin(t);
elseif t >= 0.6
y(i)=0;
end
i = i+1;
end
much appreciated

댓글을 달려면 로그인하십시오.


Saurabh Sakpal
Saurabh Sakpal 2014년 12월 18일
OK with ps-s converter i have got theres a circle on end, and an arrow on another. the circle doesn't seem to connect to anything….the arrow does….., so i just connect the arrow to the voltage supply, and then ground that the voltage supply, as i can't connect when its in a closed circuit, as it is closed….

Saurabh Sakpal
Saurabh Sakpal 2014년 12월 18일
Thanks again for your help. Appreciate it.

Saurabh Sakpal
Saurabh Sakpal 2014년 12월 19일
Hey its me again, with regards to the PS converter, i have found something else called controlled voltage source. can this work as a replacement?

카테고리

Help CenterFile Exchange에서 Electrical Sensors에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by