Discretization before or after closing the feedback loop?

Say I have a continous plant which is controlled by a digital controller. In order to apply methods from discrete control, I can change from the continous $$s$$-domain to the discrete $$z$$-domain. Now say I have plant $$G(s)$$, controller $$R(s)$$ and closed loop system $$G_R(s)$$

$$G_R(s)=\frac{G(s)R(s)}{1 + G(s)R(s)}$$

Should I discretize first $$G(s)$$ and $$R(s)$$ individually to compute from them the discrete $$G_R(z)$$ or should I directly discretize the continous $$G_R(s)$$?

I ask because in Matlab I get the problem that I get a different closed loop behavior depending on that order...

Edit: By discretization I mean the Matlab command c2d which transforms a transfer function from continous (Laplace) to discrete, for example with ZOH sampling.

• What do you mean by "discretization", what exactly are you doing? I suspect it's Fourier transform, but I'd like to be sure. Oct 16 '18 at 21:27
• @YuriyS I edited my answer. Its conversion from Laplace-transform to $z$-transform rather. Oct 17 '18 at 5:32
• SampleTIme, I'm not familiar with terminology from control, but in your links it seems like you are just sampling the continuous function $f(s)$ over a grid $s_n$, and connecting the points by step functions. In any case, I think it's better to perform this step after computing $G_R(s)$. However, I would wait until someone with knowledge of the field comes along. Oct 17 '18 at 6:45

Often the biggest difference between $$G(s)$$ and it discretized with ZOH is that it adds delay and thus a phase drop proportional to frequency. The DAC, ADC, computing the controllers output and maybe some other factors can add some additional delay to the plant. Delay will affect the phase margin of your closed loop, so too much delay might make it unstable. If you want to design a digital controller for $$G(s)$$ in real life then I would recommend to measure its frequency response function or use some other system identification method to be sure about the amount of delay your system has.