# Plot for Toronto Gas price by week

## This plot is broken.

```time1disp =

S
S
M
T
T
W
T

ans =

Empty matrix: 0-by-1

Error using circshift
Invalid shift type: must be a real finite integer vector```
• Created by: Albert Yam

### Albert Yam (view profile)

• Latest result: time1disp = S S M T T W T ans = Empty matrix: 0-by-1 Error using <a href="matlab:matlab.internal.language.introspective.errorDocCallback('circshift')" style="font-weight:bold">circshift</a> Invalid shift type: must be a real finite integer vector
• Created on: 26 Mar 2012
• Liked: 4 times

Would be more useful if Trendy updated at 2pm rather than midnight.

Included from trend description: Toronto gas price from tomorrowsgaspricetoday.com

```% Toronto Gas price
%   time vector is: time1520
time1520 = time1520 + 0.25;%since is predicting next day
TD = datestr(time1520','d');
%   data vector is: data1520
time1 = time1520(end-6:end);
time1disp = datestr(time1','d')
data1 = data1520(end-6:end);

Su = mean(data1520(1:7:end));
M = mean(data1520(2:7:end));
Tu = mean(data1520(3:7:end));
W = mean(data1520(4:7:end));
Th = mean(data1520(5:7:end));
F = mean(data1520(6:7:end));
Sa = mean(data1520(7:7:end));
data2 = [Su M Tu W Th F Sa];
time2 = time1520(1:7);
find(TD(end-6:end)==TD(3))+4
data2 = circshift(data2',find(TD(end-6:end)==TD(3))+4);
time2 = circshift(time2',find(TD(end-6:end)==TD(3))+4);
time2disp = datestr(time2,'d')

hold on
plot(time1,data1, 'o-');
plot(time1,data2, 'rx');
datetick
grid on
ylabel('Price')
datetick('x','d')
legend('This week','Week Day ave','Location','NorthWest')

price = num2str(data1(end));
text(time1(end), data1(end)+0.25, ...
{price});

today2 = datestr(time1(end))
text(time1(end)-1, data1(end)-0.25, ...
{today2});

hold off

%%
if 0

format long
TD = datestr(time1520','d');
DAT = data1520'
test=find(TD(end-6:end)==TD(1))
format short

end```
Tags:

Albert Yam

### Albert Yam (view profile)

over 3 years ago

Well, not really useful unless there is a way to get Trendy to update it at 2-3pm instead of 12:15 am. But I tried.

Albert Yam

### Albert Yam (view profile)

almost 3 years ago

Fixed, error due to website change.