PROGRAM :
1)
#include <stdio.h>
#include <stdlib.h>
int main() {
// Initial array x
int x[]= {1,2,3,4,5};
// Array p containing subsequence p= p0, p1, ..., pm-1
int p[]= {6,7,8};
// Resultant array containing all elements of x and subsequence
p
int y[100];
// Index where insert occurs ; it can be user input also
int k =2;
//Size of subsequence p
int m = sizeof(p)/sizeof(int);
//Size of x
int n = sizeof(x)/sizeof(int);
//Resultant size of y after insert occurs i.e m+n
int o = m+n;
int i;
//Copy all elements of x into y
for(i=0;i<n;i++){
y[i]=x[i];
}
//Value of y = {1,2,3,4,5}
//Shift elements of y starting from index = k to index =(n -1) by m
spaces to accomodate subsequence p of size m
for(i=k;i<n;i++){
y[i+m]=x[i];
}
//Value of y = {1,2,3,4,5,3,4,5}
//Copy subsequence p into y starting from index = k to index =
(k+m-1)
for(i=0;i<m;i++){
y[k]=p[i];
k++;
}
//Value of y = {1,2,6,7,8,3,4,5}
//Print the resultant array y
//General representation of y = {x0, x1, ... ,xk-1, p0, p1, ... ,
pm-1, xk, xk+1, ... xk+m-1}
for(i=0;i<o;i++)
printf("%d ",y[i]);
return 0;
}
ECE 270 Computer Methods in ECE OnLine Quiz #5 June 4, 2019/Instructor: Paul Watta 1. Math Analysis. Given the foll...
please do on paper then program 3. Sampling. Write a function to generate samples of the ramp function y 5 (a) Write a mathematical expression for y. Use piece-wise linear notation. Suppose we want to create a plot of the ramp function from t- o to t=2 using a step of 0.1. (b) Write the numbers that need to be created and stored for the t-samples and the y-samples. Note: Write them all out. Don't be lazy! (c) Write a...