How to plot a periodic signal without knowing mathematical equations?
Show older comments
I want to create and plot a periodic signal for a school project but I do not know the mathematical expression, I observed this wave from oscilloscope. The wave is shown in picture roughly it is symmetric about vertical line, the periodicity of wave is 100 Hz and the amplitude is 20 volt peak to peak. I also need to export 1000 data from one cycle of wave. If anyone can help me I will be appreciated, thanks in advanced.

2 Comments
Matt J
on 30 Jun 2018
And what is the role of Matlab in this? You want to extract the data from the oscilloscope using the Instrument Control Toolbox?
truckdriver
on 1 Jul 2018
Accepted Answer
More Answers (1)
truckdriver
on 30 Jun 2018
0 votes
7 Comments
Image Analyst
on 30 Jun 2018
What's wrong with that? Just change
plot(t10, v10)
to
plot(t10, v10, 'r-', 'LineWidth', 2);
and shift your x so that it crosses at .005 instead of .035 and you've got what you need. Right?
Star Strider
on 30 Jun 2018
@ozan eren — As always, my pleasure.
Here, ‘v1’ is the original vector you asked for, and ‘v2’ will create the second one you want (with both curves concave upwards):
v1 = [(1.11*exp(461*t)-1).*((t>=0) & (t<=0.005)) + (111*(1-exp(-461*t))-110).*((t>=0.005) & (t<=0.01))];
v2 = [(1.11*exp(461*t)-1).*((t>=0) & (t<=0.005)) + (0.111*(exp(461*t))-11).*((t>=0.005) & (t<=0.01))];
The ‘v2’ vector re-creates the original vector (the part from 0 to 0.005), and just shifts it downwards. They are both the same length, so you can use them in the repmat call to create a series of them, just as with ‘v1’. That part does not change.
@Image Analyst — Thank you.
truckdriver
on 1 Jul 2018
Edited: truckdriver
on 1 Jul 2018
Star Strider
on 1 Jul 2018
As always, my pleasure.
I am not certain what you intend by ‘export’. One option is to create a function file from my code, then call the function from whatever script you want.
Example —
function [t2,v] = WaveForm2(N)
t = linspace(0, 0.01, 100);
v2 = [(1.11*exp(461*t)-1).*((t>=0) & (t<=0.005)) + (0.111*(exp(461*t))-11).*((t>=0.005) & (t<=0.01))];
t2 = linspace(0, 0.01*N, 100*N);
v = repmat(v2, 1, N);
end
then save it as ‘WaveForm2.m’, and call it in any script as:
[t,v] = WaveForm2(N); % ‘N’ Must Be An Integer
Otherwise, you can use the save function to save the original waveform to a .mat file, then load it whenever you want.
NOTE — I have not tested the function here. The code has not changed. It should work.
truckdriver
on 1 Jul 2018
truckdriver
on 1 Jul 2018
Star Strider
on 1 Jul 2018
As always, my pleasure!
Categories
Find more on Subplots 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!

