How to use imagesc command?

Hello.
I am working on a program through which i want to show my power through imagesc command but i don't know how to use imagesc command.This is the programme i am working on and i want to plot the power through imagesc. Help me.
clc; clear;
[hdf,record]=edfread('Vikram-Maze_with-16.12.15.11.50.57.edf');
d=record(3:16,:);
r=d';
c=record';
mrkrs=record(36,:);
m=mrkrs';
n_start=find(m==5);
c_start=find(m==6)-1000;
c_ends=find(m==7);
n_ends=find(m==8);
n1=r(n_start:n_ends,:);
[b,a]=butter(4,[4 12]/64);
d_theta=filter(b,a,r);
power=100*(norm(d_theta(:,1)).^2)/(length(d_theta));
After this i want imagesc graph thorugh which power is to be shown in graph limited in x and y axis. help me ASAP.

回答 (1 件)

Walter Roberson
Walter Roberson 2016 年 4 月 4 日

1 投票

norm(d_theta(:,1)) is going to be a scalar, so you are calculating power as a scalar.
It looks to me as if d_theta might have 14 columns, so you could potentially create one power per column, but that would only get you a 1 x 14 vector, which does not seem worth using imagesc() for that. But if you want...
d_power = 100 * sum(d_theta.^2) / size(d_theta,1);
imagesc(d_power)

5 件のコメント

Ankit Shukla
Ankit Shukla 2016 年 4 月 4 日
編集済み: Walter Roberson 2016 年 4 月 4 日
If that is not worth then which command is to use?
I do have one more option to use spectrogram function. If you know then you can tell me how to create the spectrogram as i don't know anything about these commands.
I want my spectrogram in Frequency and time only.
I have tried one command which gives me spectrogram in power, frequency and time but i want it to be in Frequency and time and the colour shown as power and also i need power for every individual column from all 1 to 14 channels or columns.
I want this in Frequency and time only so help me plot it in Frequency and time.
This is the command i have used to plot spectrogram. Help me to modify it so i can get my answer in Frequency,time.
[s,f,t,p]=spectrogram(d_theta(:,1),64,32,64,128);
h=surf(t,f,10*log10(p),'edgecolor','none');
axis tight;
xlabel('time');
ylabel('frequency');
zlabel('power');
Walter Roberson
Walter Roberson 2016 年 4 月 4 日
Walter Roberson
Walter Roberson 2016 年 4 月 4 日
pcolor(t, f, 10*log10(p))
or, keep your current plotting code and add
view(2)
Ankit Shukla
Ankit Shukla 2016 年 4 月 5 日
this command doesn't works. shows a black figure.
Walter Roberson
Walter Roberson 2016 年 4 月 5 日
Which of the "this" shows a black figure?
You might need
pcolor(t, f, 10*log10(p), 'edgecolor', 'none')

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeLine Plots についてさらに検索

タグ

質問済み:

2016 年 4 月 4 日

コメント済み:

2016 年 4 月 5 日

Community Treasure Hunt

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

Start Hunting!

Translated by