# i wanted the slope with respect to time frame

10 ビュー (過去 30 日間)
CalebJones 2019 年 9 月 4 日
コメント済み: Star Strider 2019 年 9 月 20 日
I wanted to calculate slope of channel 1 to 15 with respect to the time frame. The values in the tables are HbO values which should be Y axis and X axis should be time time frame which in this case is 1510.
I have attached my data file as well.
How do i calculate the slope of channels 1 to 15 indivijually and place the values in a different table and perhaps even plot to visually see it????
Something similar to the url i have posted above.
Thank you
##### 2 件のコメントなしを表示なしを非表示
Jan 2019 年 9 月 4 日
The question is not clear. What are "channels 1 to 15"? Why did you highlight the first cell? What are "HbO" values? Where do we find the "time frame"?
CalebJones 2019 年 9 月 4 日
Jan HbO is Heomoglobin values. Highlighted 1st column is HbO amplitude for channel 1 which is outputed from the machine.
Time frame is row index which starts at 1 and ends at 1510.
So 15 columns shows HbO amplitude of 15 channels.
So i wanted to perform polyfit func on curve from channel 1.
So one by one i wanted to calculate the slope of each channel so.

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

### 採用された回答

Star Strider 2019 年 9 月 4 日
First, negative values for haemoglobin or oxyhaemoglobin do not make sense physiologically.
I have no idea what you want to do, so start with:
HbO = D.HbO_good_channel;
Ts = 35/size(HbO,1); % Create A Sampling Interval, Since None Are Provided
T = linspace(0, size(HbO,1), size(HbO,1))*Ts; % Time Vector
lgdc = sprintfc('Ch %2d', 1:size(HbO,2)); % Legend String Cell Array (Channels)
figure
plot(T, HbO)
grid
xlabel('Time')
ylabel('HbO')
legend(lgdc, 'Location','eastoutside')
for k = 1:size(HbO,2)
cfs(k,:) = polyfit(T(:), HbO(:,k), 3); % Coefficient Vectors: ‘polyfit’
end
figure
hold all
for k = 1:size(HbO,2)
pf(:,k) = polyval(cfs(k,:), T(:)); % Evaluate Fitted Polynomials
plot(T, pf(:,k))
end
hold off
grid
xlabel('Time')
ylabel('Regression Fit')
legend(lgdc)
Experiment to get the resultl you want.
##### 20 件のコメント18 件の古いコメントを表示18 件の古いコメントを非表示
CalebJones 2019 年 9 月 20 日
Is this right way ?
I have a mat file below of the dataset.
You have to predict rest or active!
Star Strider 2019 年 9 月 20 日
I have no idea. As I mentioned before, I have very little recent experience with classification, and essentially no experience with SVM.
I suggest that you open a new Question on this.

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

### その他の回答 (1 件)

Jan 2019 年 9 月 4 日

Maybe all you need is to call the gradient(X.') function, where X is the complete matrix?

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

### カテゴリ

Help Center および File ExchangeStatistics and Machine Learning Toolbox についてさらに検索

### Community Treasure Hunt

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

Start Hunting!

Translated by