Hey guys

I have the following problem to solve,

```
clear all
clc
format long g
cvx_startup
n = 2; % I want to run this problem for n=8760 (which number of hours in a year), but im just trying to do it for 1 hour in the beginning.
Data = xlsread('Cons_CO2 (1)');
price = xlsread('Prices');
CO2 = Data(1:n,2);
q = Data(1:n,1);
P = (price(:,8)+price(:,10))/2;
a = 15; % close to inelastic demand
b = zeros(n,1);
for i = 1:n
b(i) = a*q(i)+P(i);
end
cvx_begin
variables S(n) CS(n) PS(n) q(n) R(n) Lambda(n) P2(n) q2(n) c d
maximize (S)
subject to
S == CS + PS
CS == ((b-P2).*q2)/2
PS == q2.*(P-0.17*q2+23)+((P-23).*q2)/2
R == Lambda .* q2
q2 == (b-P2)/a
P2 == Lambda + P
sum(R) >= (10000000000 / (365 * 24)) * n
Lambda == c*CO2.^2+d
cvx_end
```

The error that I get is:

Error using .* (line 262)

Disciplined convex programming error:

Invalid quadratic form(s): not a square.

Error in Untitled4 (line 29)

CS == ((b-P2).*q2)/2
%int(-a*q2+b,[0 q2])

Thanks for the help in advance