Setting a small case in PowerModels as m file

hello there,

I want to test a small 3 bus system on PowerModels and I had to modify the case5.m into case3.m since there was no smaller system than 5 bus network
however I get this error when I run my julia file with the case3.m
“LoadError: BoundsError: attempt to access 6-element Array{Int64,1} at index [5:24]”
This is my network snap
and These are the contents of my 3 bus network m file

function mpc = case3

%% MATPOWER Case Format : Version 2
mpc.version = '2';

%%-----  Power Flow Data  -----%%
%% system MVA base
mpc.baseMVA = 100;

%% bus data
%	bus_i	type	Pd	Qd	Gs	Bs	area	Vm	Va	baseKV	zone	Vmax	Vmin
mpc.bus = [
	1	3	0	0	0	0	1	1	0	230	1	1.1	0.9;
	2	1	400	250	0	0	1	1	0	230	1	1.1	0.9;
	3	2	0	0	0	0	1	1	0	230	1	1.1	0.9;
	
];



%% generator data
%	bus	Pg	Qg	Qmax	Qmin	Vg	mBase	status	Pmax	Pmin	Pc1	Pc2	Qc1min	Qc1max	Qc2min	Qc2max	ramp_agc	ramp_10	ramp_30	ramp_q	apf
mpc.gen = [
	1	40	0	30	-30	1	100	1	40	0	0	0	0	0	0	0	0	0	0	0	0;
	1	170	0	127.5	-127.5	1	100	1	170	0	0	0	0	0	0	0	0	0	0	0	0;
	3	323.49	0	390	-390	1	100	1	520	0	0	0	0	0	0	0	0	0	0	0	0;
	
];

%% branch data
%	fbus	tbus	r	x	b	rateA	rateB	rateC	ratio	angle	status	angmin	angmax
mpc.branch = [
	1	2	0.02	0.04	0.00712	400	400	400	0	0	1	-30	30;
	1	3	0.01	0.03	0.03126	0	0	0	0	0	1	-30	30;
	2	3	0.0125	0.025	0.01852	0	0	0	0	0	1	-30	30;

];

%%-----  OPF Data  -----%%
%% generator cost data
%	1	startup	shutdown	n	x1	y1	...	xn	yn
%	2	startup	shutdown	n	c(n-1)	...	c0
mpc.gencost = [
	1	0	0	10	0	0;
	1	0	0	0	0	0;
	1	0	0	50	0	0;
	
];

Please read the first post of Please read: make it easier to help you - #81 and provide a reproducible example, including a simplified version of the code the reproduces the error, and the full text of the error message.

In the example you give the generator cost information is not following the Matpower specification. Something like this should work,

mpc.gencost = [
	2	0	0	3	10	0	0;
	2	0	0	3	0	0	0;
	2	0	0	3	50	0	0;
];

I can also recomend you have look at, https://github.com/power-grid-lib/pglib-opf, as a source of high quality transmission network cases.

Thank you @ccoffrin
I took this link as my reference and put 1 for a linear gen cost function, but I tried yours and it worked…It means choosing a polynomial and teh putting my a coefficient and other coefficents as zero

Description of caseformat.