function [Gm,Pm,Ms,Mt]=marginsminbodeideal(numg,deng,deadtime,Kc,taui,taud)
% This is the function marginsminbodeideal.m
% Simple routine made for computing stability margins for PID cascade controller using minbode
% Usage:  [Gm,Pm,Ms,Mt]=marginsminbode(numg,deng,deadtime,Kc,taui,taud)
% Alternative (no time delay): marginss(numg,deng,Kc,taui,taud)
% NOTE: Ideal form PID controller

   w= logspace(-4,4,4000);
   num=conv(numg,[taud 1 1/taui]); 
   den=conv(deng,conv([1 0],[0.000001*taud 1])); 
    gain=Kc; 
    [A,vA,w180,wc,Gm,Pm,Ms,Mt]=minbode(num,den,gain,deadtime,w);
    marginsminbodeideal=[Gm,Pm,Ms,Mt] 