Getting shifted frequency curves instead of normal ones
2 views (last 30 days)
Show older comments
Why do I get somehow displaced curves ( see first picture) that should normally be an unshifted curve?(see the second picture)
The frequency is calculated through given frequency values and a time column
The code looks like the following
nexttile
Fd1 = double(split(string(fdim1(1:end-1)) , ","));
Fd1 = Fd1(:,1);
plot(timefdim1(1:end-1),Fd1);
xticks([timefdim1(1) timefdim1(end-1)]);
yticks([Fd1(1) Fd1(end-1)]);
title('dimfrequency 1')
xlabel('Uhrzeit in [HH:MM:SS]')
ylabel('Frequenzintervall 150kHz - 80 MHz')
nexttile
Fd2 = double(split(string(fdim2(2:end-1)) , ","));
Fd2 = Fd2(:,1);
plot(timefdim2(2:end-1),Fd2);
xticks([timefdim2(2) timefdim2(end-1)]);
yticks([Fd2(2) Fd2(end-1)]);
title('dimfrequency 2')
xlabel('Uhrzeit in [HH:MM:SS]')
ylabel('Frequenzintervall 80 MHz - 1 GHz')
nexttile
Fd3 = double(split(string(fdim3(3:end-1)) , ","));
Fd3 = Fd3(:,1);
plot(timefdim3(3:end-1),Fd3);
xticks([timefdim3(1) timefdim3(end-1)]);
yticks([Fd3(1) Fd3(end-1)])
title('dimfrequency 3')
xlabel('Uhrzeit in [HH:MM:SS]')
ylabel('Frequenzintervall 1 GHz - 2,7 GHz')
nexttile
F1 = double(split(string(fbll1(1:end-1)) , ","));
F1 = F1(:,1);
plot(timefbll1(1:end-1),F1);
xticks([timefbll1(1) timefbll1(end-1)]);
yticks([F1(1) F1(end-1)]);
title('bllfrequency 1')
xlabel('Uhrzeit in [HH:MM:SS]')
ylabel('Frequenzintervall 150kHz - 80 MHz')
nexttile
F2 = double(split(string(fbll2(2:end-1)) , ","));
F2 = F2(:,1);
plot(timefbll2(2:end-1),F2);
xticks([timefbll2(2) timefbll2(end-1)]);
yticks([F2(2) F2(end-1)]);
title('bllfrequency 2')
xlabel('Uhrzeit in [HH:MM:SS]')
ylabel('Frequenzintervall 80 MHz - 1 GHz')
nexttile
F3 = double(split(string(fbll3(3:end-1)) , ","));
F3 = F3(:,1);
plot(timefbll3(3:end-1),F3);
xticks([timefbll3(1) timefbll3(end-1)]);
yticks([F3(1) F3(end-1)])
title('bllfrequency 3')
xlabel('Uhrzeit in [HH:MM:SS]')
ylabel('Frequenzintervall 1 GHz - 2,7 GHz')
Thanks a lot in advance for the help.
4 Comments
Accepted Answer
Ameer Hamza
on 22 Sep 2020
Edited: Ameer Hamza
on 22 Sep 2020
The time vectors were stored in categorical datatype (bad choice). Therefore, you were getting that unexpected plots. Try the following code. I have only added lines before the plot() statement.
nexttile
Fd1 = double(split(string(fdim1(1:end-1)) , ","));
Fd1 = Fd1(:,1);
timefdim1 = duration(string(timefdim1));
plot(timefdim1(1:end-1),Fd1);
xticks([timefdim1(1) timefdim1(end-1)]);
yticks([Fd1(1) Fd1(end-1)]);
title('dimfrequency 1')
xlabel('Uhrzeit in [HH:MM:SS]')
ylabel('Frequenzintervall 150kHz - 80 MHz')
nexttile
Fd2 = double(split(string(fdim2(2:end-1)) , ","));
Fd2 = Fd2(:,1);
timefdim2 = duration(string(timefdim2));
plot(timefdim2(2:end-1),Fd2);
xticks([timefdim2(2) timefdim2(end-1)]);
yticks([Fd2(2) Fd2(end-1)]);
title('dimfrequency 2')
xlabel('Uhrzeit in [HH:MM:SS]')
ylabel('Frequenzintervall 80 MHz - 1 GHz')
nexttile
Fd3 = double(split(string(fdim3(3:end-1)) , ","));
Fd3 = Fd3(:,1);
timefdim3 = duration(string(timefdim3));
plot(timefdim3(3:end-1),Fd3);
xticks([timefdim3(1) timefdim3(end-1)]);
yticks([Fd3(1) Fd3(end-1)])
title('dimfrequency 3')
xlabel('Uhrzeit in [HH:MM:SS]')
ylabel('Frequenzintervall 1 GHz - 2,7 GHz')
nexttile
F1 = double(split(string(fbll1(1:end-1)) , ","));
F1 = F1(:,1);
timefbll1 = duration(string(timefbll1));
plot(timefbll1(1:end-1),F1);
xticks([timefbll1(1) timefbll1(end-1)]);
yticks([F1(1) F1(end-1)]);
title('bllfrequency 1')
xlabel('Uhrzeit in [HH:MM:SS]')
ylabel('Frequenzintervall 150kHz - 80 MHz')
nexttile
F2 = double(split(string(fbll2(2:end-1)) , ","));
F2 = F2(:,1);
timefbll2 = duration(string(timefbll2));
plot(timefbll2(2:end-1),F2);
xticks([timefbll2(2) timefbll2(end-1)]);
yticks([F2(2) F2(end-1)]);
title('bllfrequency 2')
xlabel('Uhrzeit in [HH:MM:SS]')
ylabel('Frequenzintervall 80 MHz - 1 GHz')
nexttile
F3 = double(split(string(fbll3(3:end-1)) , ","));
F3 = F3(:,1);
timefbll3 = duration(string(timefbll3));
plot(timefbll3(3:end-1),F3);
xticks([timefbll3(1) timefbll3(end-1)]);
yticks([F3(1) F3(end-1)])
title('bllfrequency 3')
xlabel('Uhrzeit in [HH:MM:SS]')
ylabel('Frequenzintervall 1 GHz - 2,7 GHz')
2 Comments
Ameer Hamza
on 24 Sep 2020
Yes, it is possible. You can use hold() command and then call several plot commands. All of them will be drawn on one axes
hold on
plot(...)
plot(...)
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!