plot a(t) and b(t) in the same plot area. let a(t) have twice the amplitude of x(t) = sin(t) and graph it in green asterisks. let b(t) have twice as many cycles as x(t) and graph it with red circles in matlab

main.m
% Define the time vector
t = 0:0.01:10;

% Define x(t) = sin(t)
x = sin(t);

% Define a(t) with twice the amplitude of x(t)
a = 2*sin(t);

% Define b(t) with twice as many cycles as x(t)
b = sin(2*t);

% Plotting a(t) and b(t) in the same plot area
figure
hold on
plot(t, a, 'g*') % Plot a(t) in green asterisks
plot(t, b, 'ro') % Plot b(t) in red circles
legend('a(t)', 'b(t)')
xlabel('Time')
ylabel('Amplitude')
title('Plot of a(t) and b(t)')
445 chars
22 lines

gistlibby LogSnag