Using Park's d-q model, the PMSM machines are usually modelled in rotor reference frame.
While modelling the equations the following assumptions are made.

With the above assumptions, the stator d, q equations of the PMSM in the rotor reference frame are-

$$ V_q = R_s i_q + \rho\alpha_q + \omega_s\alpha_d $$
$$ V_d = R_s i_d + \rho\alpha_d - \omega_s\alpha_q $$
where.

$$ V_q \ and \ V_d \ are\ q-axis\ and\ d-axis\ voltages. \nonumber$$,
$$ i_q \ and \ i_d \ are\ q-axis\ and\ d-axis\ currents. \nonumber$$,
$$ \alpha_d \ and \ \alpha_q \ are\ the\ d, q\ axis\ stator\ flux\ linkages.\nonumber$$
$$ R_s \ stator\ resistance\nonumber$$
$$ \alpha_{PM}\ flux\ linkage\ due\ to\ the\ rotor\ magnets\ linking\ the\ stator\nonumber$$.
$$ \rho \ is\ a\ time\ derivative\nonumber$$
# Sample Matlab publish to html

Initialize the parameters

x=1:1:10;
n=numel(x);
y=zeros(1,n);
for k=1:n
y(k)=-3*x(k)^2;
end
plot(x,y,'--o')
x
y

x =
1 2 3 4 5 6 7 8 9 10
y =
-3 -12 -27 -48 -75 -108 -147 -192 -243 -300