필터 지우기
필터 지우기

the best way to import signal from workspace

조회 수: 3 (최근 30일)
Andreas
Andreas 2012년 10월 12일
hello. i need to import a sinewave from matlab workspace. this must be compared with a sawtooth with the use of simscape component comparator. should i use the block 'from workspace' or 'signal from workspace'. what is the default data type of the saved sinewave in matlab workspace? how can i check or find in matlab what kind of data structure and type is a saved signal?
thank you.

답변 (1개)

Azzi Abdelmalek
Azzi Abdelmalek 2012년 10월 12일
편집: Azzi Abdelmalek 2012년 10월 12일
in matlab command
t=0:0.1:100
y=sin(t)
ty=[t' y']
in from workspace block set variable name to ty
or you can use from file then
t=0:0.1:100
y=sin(t)
ty=[t; y]
save filename ty
in from file block set file name block to filename
  댓글 수: 1
Andreas
Andreas 2012년 10월 17일
ok. in fact i have used this code
%t=0.02sec %fsampling=100MHz
t=(1:1:2000000)';% Time Samples f=1000;% Input Signal Frequency fs=100000000;% Sampling Frequency x=(0.8*sin(2*pi*f/fs*t));% Generate Sine Wave
sine=[t,x];
but my simulation results are different from the ones i get if i use a sinewave block from simulink library. what am i doing wrong?

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by