doing a boxcar or rectwin ?

조회 수: 40 (최근 30일)
A
A 2013년 4월 20일
Hello,
This is my first post here in this forum. I hope I get what I want.
I am a very beginner Matlab user. What I want to do is to plot multiple rectangle ( for fMRI block design , for ex: such as this one : ----__----__----__----__ ( or baseline block baseline block baseline ..etc) Of course this is not a perfect example. The most important thing that I am looking to do is the timing. For example I want the the baseline starts from 0 and last for 20 seconds. Then the rectangular box or the block starts from 20 and last to 40 seconds and so on. So a total of, for example, 10 blocks, 5 baselines and 5 task or box or blocks. So the total time is 10*20=200 seconds.
I tried different function in matlab such as rectwin or rectangularPulse but honestly I could not do it.
NB: I wan not sure whether I should post this here or in the question section!
Thanks
  댓글 수: 1
Image Analyst
Image Analyst 2013년 4월 21일
This IS the question section. Not sure what you were thinking about. Newsgroup maybe?

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

답변 (1개)

Image Analyst
Image Analyst 2013년 4월 21일
Use zeros() and ones() to make a cycle, then repmat to replicate it, like this demo:
rectWidth = 10;
oneCycle = [zeros(1, rectWidth), ones(1, rectWidth)];
% Plot it
subplot(2,1,1);
plot(oneCycle, 'bs-', 'LineWidth', 3);
grid on;
ylim([0 1.1]);
% Use repmat to make lots of them
numberOfCycles = 6;
multipleCycles = repmat(oneCycle, [1, numberOfCycles]);
% Plot it
subplot(2,1, 2);
plot(multipleCycles, 'bs-', 'LineWidth', 2);
grid on;
ylim([0 1.1]);
% Enlarge figure to full screen.
set(gcf, 'units','normalized','outerposition',[0 0 1 1]);

카테고리

Help CenterFile Exchange에서 Propagation and Channel Models에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by