How can i change this plot to be be in this form
Show older comments
Please, how can i make the 2D plot (attached image -row plot) appear like any of the signal plots(attached image -signal) in the other image. kindly simplify codes, as I am new to MAtlab
Answers (1)
If you'd like to make a subplot,
figure
subplot(4,1,1) % see help subplot
plot(row_data)
title('My row plot')
xlabel('time (ms)')
ylabel('Amplitude (v)')
8 Comments
Folakemi Omotoye
on 23 Jul 2018
Adam Danz
on 23 Jul 2018
Do you mean you want a series of dots where each spike peaks or you just want a diagonal line going through each of the peaks? Your question is very unclear.
Folakemi Omotoye
on 23 Jul 2018
Adam Danz
on 23 Jul 2018
I understand now. However, there's no simple answer without looking at your data and how you created that plot in the first place. Please attached your data or paste the first few dozen values of your data. It would also be helpful to see your code for the spike plot, if available.
Folakemi Omotoye
on 23 Jul 2018
Adam Danz
on 23 Jul 2018
Hi Folakemi, There are lots of problems with this code and it doesn't make much sense.
For example, why does 'm' need to be a 3D array? Why is the call to linespace within the k-loop when it doesn't change at all within that loop? Why take the sum over m when all the values in m are zeros except for 1 number?
I have a feeling this code doesn't do what it is intended to do.
That being said, the (x,y) coordinates of the spikes are as follows.
The y coordinates are just the value of 't'. You don't need the loop at all.
The x coordinates as your data currently stands are 3:10:300 but I have a feeling this is meaningless.
To plot a line over the spikes,
n = 30;
t = linspace(0,1.0,n);
plot(3:10:300, t, 'r-o')
Folakemi Omotoye
on 24 Jul 2018
Adam Danz
on 24 Jul 2018
M is a 3D array but the size of each dimension is (10,10,30). An RGB matrix would have 3 columns, not 10.
Here's a plot of your code (in blue) and my code (in red). The only thing I changed in my code was the line style.
It plots the peaks in a straight line.

Categories
Find more on White in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!