hello, I am working on making the output of my code visually nicer. yes this is homework, but I already have the correct answers and working code for the homework problem. I understand the homework, now I am attempting to just clean the output up to make it readable by others outside of the class.
if true % code
L1 = 250;L2 = 200;L3 = 200;f = [40; 50; 55; 0; 0;];Aeq = [1 1 1 0 0 ;0 1 0 -15 5;0 0 1 5 -13 ];Beq1 = [10; 3.5; 4.5]; Beq2 = [11; 3.5; 4.5];Beq3 = [9; 3.5; 4.5];Aineq = [0 0 0 -10 0;0 0 0 10 0;0 0 0 0 -8;0 0 0 0 8;0 0 0 -5 5;0 0 0 5 -5];Bineq = [L1;L1;L2;L2;L3;L3]/100;lb = [0; 0; 0; -pi; -pi];ub = [8.2; 6; 6.1; pi; pi ];% Hour 1
fprintf('Homework #2 problem #1 EEL-4932 Intro to Smart Grid Spring 2016.\n')fprintf('Raymond L. Brunkow\n\n')[x,fval,exitflag,output,lambda] = linprog(f, Aineq, Bineq, Aeq, Beq1, lb, ub);x(1)=x(1)*100;x(2)=x(2)*100;x(3)=x(3)*100;cost = 40*x(1) + 50*x(2) + 55*x(3);fprintf('\nThe cost for hour 1 is $%4.2f per MW.\n',cost);fprintf('The following values for PG1, PG2, PG3, Gamma 2, and Gamma 3 are as follows:\n');disp(x);end
That is the working code. For Beq2 & 3 the output sections are the same for hours 2 and 3 so no need to copy/paste them here.
The output I am getting is as follows:
if true % codeThe cost for hour 1 is $44750.00 per MW.The following values for PG1, PG2, PG3, Gamma 2, and Gamma 3 are as follows:650.0000100.0000250.0000 -0.2500 -0.2500end
What I would like to do is somehow in a matrix or table like output add the following vector/column:
if true % codePG1PG2PG3Gamma 2Gamma 3end
Such that they line up with the output from linprog to look something like:
if true % codeThe cost for hour 1 is $44750.00 per MW.The following values for PG1, PG2, PG3, Gamma 2, and Gamma 3 are as follows:PG1 650.0000PG2 100.0000PG3 250.0000Gamma 2 -0.2500Gamma 3 -0.2500end
Is that even possible? If so how? If not, well that is good too.
Thank you all in advance.
Best Answer