creating buttons for user input - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

creating buttons for user input

manit123manit123 Posts: 3Member

My aim is to illustrate lissajous figure of CRO.
The concept is to plot a locus of point whose x & y coordinate vary with time.
In the code given below I have put x=sin(constant x t) , y=cos(1.5 x constant x t)

Fs = 8000; % samples per second
dt = 1/Fs; % seconds per sample
StopTime = 6.00; % seconds
t = (0:dt:StopTime-dt)'; % seconds
%% Sine wave:
Fc = 80; % hertz
c = -pi:.04:pi;
cx = sin(piFct);
cy = cos(1.5piFc*t);
axis on, axis equal
line(cx, cy, 'color', [.4 .4 .8],'LineWidth',3);
title('sine on x , cos on y ','Color',[.6 0 0])
hold on
while (1)
for t = 1:length(t)
x(2) = cx(t);
y(2) = cy(t);
t = (0:dt:StopTime-dt)';

I have 3 questions
(1)If you will run this , you will see (other than a nice double boomerang animation) a red dot at origin in graph which I want to avoid.
(2)I want to create a slider button for user which replaces 1.5 in above . This way , when slider=1 you will see circle , as frequency multiplies you will see more vertically side by side loops . As frequency diminishes to fraction loop will appear horizontally stacked.
(3)it would be more exciting if there is a slider for changing phase difference .Currently it is 90 degree . As it will decreases the ellipse flattens. becomes straight line for 0 degree.

Thank You.
Eagerly waiting for your reply.

Sign In or Register to comment.