18 views (last 30 days)

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????

- Slope: the value that fits a regression line to the given data set.
- https://journals.plos.org/plosone/article/figure/image?size=medium&id=info:doi/10.1371/journal.pone.0208843.g007

Something similar to the url i have posted above.

Thank you

Star Strider
on 4 Sep 2019

First, negative values for haemoglobin or oxyhaemoglobin do not make sense physiologically.

I have no idea what you want to do, so start with:

D = load('HbO_Good_channels.mat');

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.

Star Strider
on 19 Sep 2019

Thank you for the paper.

I have no recent experience with the details of classification, since I have not used it in a while, and SVM was not yet available (at least to my knowledge) the last time I did extensive classification.

Rather than using ‘libSVM’, use the procedures outlined in Support Vector Machine Classification. (These first appeared in R2014a, so were not available when that research was done.)

Star Strider
on 20 Sep 2019

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.

Sign in to comment.

Sign in to answer this question.

Opportunities for recent engineering grads.

Apply Today
## 2 Comments

## Direct link to this comment

https://es.mathworks.com/matlabcentral/answers/478799-i-wanted-the-slope-with-respect-to-time-frame#comment_742110

⋮## Direct link to this comment

https://es.mathworks.com/matlabcentral/answers/478799-i-wanted-the-slope-with-respect-to-time-frame#comment_742110

## Direct link to this comment

https://es.mathworks.com/matlabcentral/answers/478799-i-wanted-the-slope-with-respect-to-time-frame#comment_742169

⋮## Direct link to this comment

https://es.mathworks.com/matlabcentral/answers/478799-i-wanted-the-slope-with-respect-to-time-frame#comment_742169

Sign in to comment.