The given Difference Equation is : y(n)=0.33x(n +1)+0.33x(n) + 0.33x(n-1). Please help me how to plot the magnitude response of this filter. Any help will be greatly appreciated.
You should not ask such an elementary question if you had read your textbook on signal processing where the z transform is addressed, as described by previous respondents.
Since you do not seem to have done this, let me give you an intuitive trick:
every time you see signal x(n), you multiply it by z^n.
Then you form the formal series (like a polynomial, but with infinite sum, formally, it does not need to converge!) X(z) = sum of x(n)z^n from n=0 to infinity
From X you get to 0.33(1+z+ z^2)X(z) which corresponds to the z transform of y' (time shift by 1 on y) call it Y'.
The product of the z transforms is also a convolution of the signals, see textbook (any), hence you have something like h*x = y'.
Again, I strongly recommend you read your textbook
You can write it in z-transform domain, then plot its Bode diagrams, you can find some info here https://learn.lboro.ac.uk/archive/olmp/olmp_resources/pages/workbooks_1_50_jan2008/Workbook21/21_3_z_trnsfm_n_difrnce_eqn.pdf
my finger calculator says it's (z^2 + z + 1)/3z with numerator degree greater than denominator's as expected for a non-casual system.
You are looking for a magnitude response of a non-causal filter, which is not physically realizable and you will have to be careful while working with the magnitude response. However, to answer your quesiton, I am suggesting some pathways to experiment with:
1. Relace n+1 = w, this will be causal system then but your output will be delayed by one sample. Use "tf" function MATLAB. The "tf" function requires numerator and denominator of transfer function. This reference is helpful to learn about constructing transfer function from difference equation: https://ccrma.stanford.edu/~jos/filters/Z_Transform_Difference_Equations.html
2. Use impulseplot(tf) for impuse response. You can also try step response. Refer to the "tf" documentation.
You need more additional information. You have X(n) and Y(m), so one recurrence equation is not enough. Also, different initial conditions lead to different solutions and, consequently, different plot representations.
In my answer I assumed Subhadip Ghosh is looking for the frequency response of this FIR filter, namely a moving average filter. In such context initial condition(s) is assumed to be zero.
In other words we're not looking for a closed-form solution of a recurrence relation but, instead, we're looking for the steady-state response to a particular input (namely complex exponential on the imaginary axis).
A longer description, from an "engineering" point of view can be found in https://www.analog.com/media/en/technical-documentation/dsp-book/dsp_book_Ch15.pdf but also https://ptolemy.berkeley.edu/eecs20/week12/freqResponseRA.html shows (with some tweak needed) another way to plot the response.
It does not matter that the filter is non-causal. If you just wait one sample then you have y1(n)=0.33x(n )+0.33x(n-1) + 0.33x(n-2) and the magnitude response is clearly the same (just the delay / phase changes). It is the classical 3-point moving average low-pass filter.
The three terms moving-average equation you have offered has a future term (x[n+1]). Then, perhaps, the conundrum. Let us solve it.
The equation is y[n] = 0.33(x[n+1] + x[n] + x[n-1]), call it eq1.
Now, move to the z-plane. To do this, replace every 'x' by 'z' raised to its respective delay, i.e., x[n] = x[n+0] -> X(z).z^(0) = 1, and so one, where X(z) is the z transform of x, and ‘^’ means ‘raised to’ the value in parentheses.
The transfer function (H(z)) of the equation eq1 in the z-plane will be:
H(z) = (0.33z^(1) + 0.33 + 0.33z^(-1)), call it f1.
Remember: H(z) = Y(z)/X(z).
Make a rearrangement in f1, then find:
H(z) = (0.33+0.33z^(-1) + 0.33z^(-2))/z^(-1). The problem is that there is a pole at the origin due to z^(-1), which complicates the frequency response. It may be non realizable. It also has a zero at 0.333...
Well, shift eq1 one sample backwards, as observed by Fernando Soares Schlindwein , then you can get:
y[n] = 0.33(x[n] + x[n-1] + x[n-2]), and, in the z-plane:
Y(z) = X(z) (0.33 + 0.33 z^(-1) + 0.33 z^(-2)),
and its H(z) will be:
H(z) = (0.33 + 0.33z^(-1) + 0.33z^(-2)), call it f2.
Note f2 is the same filter as f1, except in that the sample 'order' is now corrected. That is, you do not need to wait for a sample that is still expected to occur (x[n+1]) to get the output (y[n]) you should have gotten in the present sample (x[n]).
Make it z = exp(jw), where j = √-1.
Now, just find the module of H(z) (|H(z)|) to get the magnitude (response) of H(z).