| |||||||||||||||||||||||||||||||||
Education for ALL
Analog vs Digital Communication System
Searching Problem in AI
Q. A farmer has a wolf, a goat and a cabbage on the west side of a river. He wants to get all of his animals and cabbage across the river onto the east side. The farmer has a row boat but he only has enough room for himself and one other thing. The wolf will eat the goat if they are left together alone. The goat will eat the cabbage if they are left together alone. How can the farmer get everything on the east side? Draw the search tree and show the final solution.
Solution:
Farmer, Wolf, Goat, Cabbage = (f,w,g,c)
West side, East side = (W,E)
Initially, all are on the West side.
(W, W, W, W)
Then,
Line Spectrum of Signal
Q. Plot the line spectrums of x(t) =12 + 6sin (140πt +30°) - 9cos(80πt-70°).
Solution:
Let’s Analyze and Plot the Line Spectrum of
x(t) = 12
+ 6sin(140πt+300) − 9cos(80πt−700)
Step 1: Convert all terms to cosine form
Use the identity: sin(θ)
= cos(θ−900)
So,
6sin(140πt+300)
= 6cos(140πt−600)
−9cos(80πt−700)
= 9cos(80πt+1100)
Thus, x(t) = 12 + 6cos(140πt−600)
+ 9cos(80πt+1100)
Step 2: Frequencies, Amplitudes, Phases
Term |
Frequency (Hz) |
Amplitude |
Phase |
12 (DC) |
0 |
12 |
0° |
6cos(140πt−600) |
f=70 |
6 |
-60° |
9cos(80πt+1100) |
f=40 |
9 |
+110° |
We split each cosine into two spectral lines at ±f with half the amplitude.
Stack Implementation using Array
// Static Implementation of Stack
#include<stdio.h>
#include<conio.h>
#define N 5
int stack[5];
int top = -1;
void push(){
int x;
printf("Enter data: ");
scanf("%d",&x);
if(top==N-1)
printf("Overflow\n");
else{
top++;
stack[top]=x;
}
}