# Anybody please share the matlab code for feeding two different waveform to two different array elements. Thanks.

2 visualizaciones (últimos 30 días)
Ananya el 24 de Feb. de 2023
Comentada: Ananya el 28 de Feb. de 2023
Signal Processing
##### 1 comentarioMostrar -1 comentarios más antiguosOcultar -1 comentarios más antiguos
John D'Errico el 24 de Feb. de 2023
What does this mean?
An array element is just a scalar value. What do you mean by feeding a wave form to a number?

Iniciar sesión para comentar.

### Respuestas (1)

Amith el 28 de Feb. de 2023
As per my understanding you wanted to know how to feed two different waveforms as two different elements of an array .So here is an example on how to do that
% Define parameters
f1 = 1e3; % Frequency of the first waveform
f2 = 2e3; % Frequency of the second waveform
t = linspace(0,1,100) % Time vector
% Create the two waveforms
waveform1 = sin(2*pi*f1*t);
waveform2 = cos(2*pi*f2*t);
% Create the array with two elements
array = zeros(2, length(t));
% Assign the waveforms to the array elements
array(1, :) = waveform1;
array(2, :) = waveform2;
% Plot the waveforms
subplot(2,1,1)
plot(t, waveform1)
xlabel('Time (s)')
ylabel('Amplitude')
title('Waveform 1')
subplot(2,1,2)
plot(t, waveform2)
xlabel('Time (s)')
ylabel('Amplitude')
title('Waveform 2')
This code creates two waveforms with frequencies of 1 kHz and 2 kHz, and then assigns them to the first and second element of an array, respectively. The code then plots the two waveforms separately for visualization.
You can modify the code to create and assign different waveforms to the array elements as needed.
##### 1 comentarioMostrar -1 comentarios más antiguosOcultar -1 comentarios más antiguos
Ananya el 28 de Feb. de 2023
Yes... This is what I mean to say. Thanks a lot.

Iniciar sesión para comentar.

### Categorías

Más información sobre Pulsed Waveforms 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!

Translated by