Error using plot: Vectors must be the same length.
1 view (last 30 days)
Show older comments
Can someone please help? I've generated a plot for Signal3, but I also need to plot a single period from Signal3 (which I've named additive_noise_first) with an appropriate time vector (which I've named tPeriod).
s3 = zeros(1, period);
s3(SinglePeriod >= 0 & SinglePeriod < 2.5) = ((A*SinglePeriod(SinglePeriod >= 0 & SinglePeriod < 2.5))/4);
s3(SinglePeriod >= 2.5 & SinglePeriod < 5) = (((-A*SinglePeriod(SinglePeriod >= 2.5 & SinglePeriod < 5))+(5*A))/4);
Signal3 = repmat(s3, [1 period]); %signal 3
subplot(3,1,3)
plot(t, Signal3, 'r')
title('Signal 3')
xlabel('Time (s)')
ylabel('Amplitude')
hold off
%% 2.0 Generate the noise waveforms
tPeriod = linspace (0, 1, sample+1); %single period
tPeriod(end) = []; %
additive_noise_first = repmat(Signal3, 1, period);
plot(tPeriod, additive_noise_first, 'r');
But I'm getting this error shown below.
Error using plot
Vectors must be the same length.
Error in mission (line 82)
plot(tPeriod, additive_noise_first, 'r');
0 Comments
Answers (1)
KSSV
on 21 Aug 2020
%% 2.0 Generate the noise waveforms
additive_noise_first = repmat(Signal3, 1, period); % assumoing this to be column/ array
tPeriod = linspace (0, 1,length(additive_noise_first)); %single period
plot(tPeriod, additive_noise_first, 'r');
0 Comments
See Also
Categories
Find more on Fourier Analysis and Filtering 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!