Task for generating a wave
    5 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    Atta Bukhari
 el 8 de Oct. de 2020
  
    
    
    
    
    Respondida: Attaullah Shafiq
      
 el 8 de Oct. de 2020
            Can you suggest me some unique code for Sine wave
Respuesta aceptada
  Attaullah Shafiq
      
 el 8 de Oct. de 2020
        %Sine wave example
f=3; %frequency [Hz]
t=(0:1/(f*100):1);
a=2;    %amplitude [V]
phi=0;  %phase
y=a*sin(2*pi*f*t+phi); %formula
plot(t,y)
xlabel('Time') %label
ylabel('Amplitude') %label
title('Sine Wave)'); %Title 
0 comentarios
Más respuestas (1)
  Ameer Hamza
      
      
 el 8 de Oct. de 2020
        unique code for Sine wave
What about using a taylor series?
N = 20;
x = 0.1;
y = @(xv) arrayfun(@(x) sum((-1).^(0:N-1).*x.^(2*(1:N)-1)./factorial(2*(1:N)-1)), xv);
xv = linspace(0, 2*pi);
yv = y(xv);
plot(xv, yv)
0 comentarios
Ver también
Categorías
				Más información sobre Startup and Shutdown en Help Center y File Exchange.
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!