How plot Sin Wave in Axes of GUI MATLAB

3 Ansichten (letzte 30 Tage)
Widya Putri
Widya Putri am 27 Mai 2016
Kommentiert: Widya Putri am 17 Jul. 2016
I wanna plot sin wave, the source is from number binary "1 and 0" from notepad.
So, what should I do for plot sinus wave?
this my coding:
axes(handles.axes4)
mod=load('D:\Polinema\Akademik\SKRIPSI\Proyek Skripsi\GUI Proyek Skripsi\blokbaru\100 mod.txt','-ascii');
plot(mod,'b','LineWidth',1.5);
axis([1 100 -1.5 1.5]);
title('Output Modulator BPSK','fontweight', 'bold');
xlabel('Sample','color','b');
ylabel('Amplitude','color','b');
grid on;
guidata(hObject, handles)
  2 Kommentare
Walter Roberson
Walter Roberson am 27 Mai 2016
That code looks plausible. Could you show us the first few lines of "100 mod.txt" ? What shows up for min(mod(:)), max(mod(:)), size(mod) ?
Widya Putri
Widya Putri am 14 Jun. 2016
100 mod.txt contain various 1 and -1 binary. they are 1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 1 1 -1 -1 1 1 1 -1 -1 -1 -1 -1 1 -1 -1 1 -1 1 -1 -1 1 1 -1 1 -1 1 1 1 -1 -1 1 1 1 1 -1 -1 1 -1 1 1 -1 1 -1 -1 1 1 -1 -1 -1 1 -1 1 -1 -1 -1 1 -1 -1 -1 1 1 1 1 -1 -1 1 -1 1 1 1 1 -1 1 -1 1 -1 -1 1 -1 -1 1 -1 -1 -1 -1 1 -1

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Shameer Parmar
Shameer Parmar am 14 Jun. 2016
Hello Widya,
Your code is correct. I tried running same code and it is working fine and the result is as shown in below snapshot:
The result is not showing the sine wave because you providing the random 1 and -1 values in .txt file. So in order to plot the sin wave you need to provide such values into .txt file, so it will plot sin wave OR if you dont want to change these values, then apply some formula so that these value get converted into new values which will produce the sin wave while plotting it.
  1 Kommentar
Widya Putri
Widya Putri am 17 Jul. 2016
Thank You sir. really its help. but you know the forumla to convert it so it can be sinus? I am so confuse. thanks.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by