how to move the graph vertically downward to zero?

Hi all,
In the attached graph there are 2 types of data the blue one is observed those are I want calculate the mean and shifting the graph to zero (over the red one). how can I do those calculating and shifting?
thank you in advance

Antworten (1)

Star Strider
Star Strider am 5 Jul. 2015
Take the mean of the blue series and subtract it:
new_blue = blue - mean(blue(:));
Without your data I cannot get any more specific. The ‘blue’ here are the dependent variable data. Your independent variable (for example x) remains unchanged.

4 Kommentare

lina
lina am 5 Jul. 2015
Bearbeitet: lina am 5 Jul. 2015
this is my data script:
dv = datevec(obs(:,1));
[d,~,m] = unique(dv(:,1:4),'rows');
out = [d,accumarray(m,obs(:,2),[],@mean)];
out(:,6)=datenum(out(:,1),out(:,2),out(:,3),out(:,4),0,0);
plot(out(:,6),out(:,5)*100)
hold on
plot(pred(:,1),pred(:,2),'r')
datetick
Doesn't do us much good without giving us obs also.
Sorry for this, the beginning of my script is:
jed = fopen('Jeddah.csv');%observed data
rawobs=textscan(jed,'%s %f','delimiter',',','headerlines',1);%raw observed data
fclose(jed);
datetime=datenum(jed);
data=[datenum(rawobs{1}),rawobs{2}];
ds = datestr(data(:,1),'dd mmm yyyy HH:MM ss');
obs=[datenum(rawobs{:,1}),rawobs{:,2}];
dv = datevec(obs(:,1));
[d,~,m] = unique(dv(:,1:4),'rows');
out = [d,accumarray(m,obs(:,2),[],@mean)];
out(:,6)=datenum(out(:,1),out(:,2),out(:,3),out(:,4),0,0);
plot(out(:,6),out(:,5)*100)
hold on
plot(pred(:,1),pred(:,2),'r')
datetick
lina, come on. This is like a comedy of errors. Do you think we'll now be able to run this without giving us the jeddah.csv file?

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Discrete Data Plots finden Sie in Hilfe-Center und File Exchange

Tags

Gefragt:

am 5 Jul. 2015

Kommentiert:

am 5 Jul. 2015

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by