1

I have 3 signals: 2 inputs and 1 output for a chemical process. The 2 inputs are sampled uniformly each minute while the output should be sampled exactly at each 30 minutes, I have it sampled sometimes at each 40 minutes or 50 etc...

My output signal cares only about the 30 minutes sampled inputs and not beyond that i.e. Each one of the inputs has a total response effected to the output from 0 to 30 minutes.

How can I resample everything in Matlab to become a series of 30 minutes time chunks intervals?

0

2 Answers 2

2

What you want to do is interpolation. The basic method to do that in one dimension is using interp1. First read the methods and decide which method fits your needs best.

Imagine val is your data points and t is the vector of data acquisition times. You can interpolate the data on the time vector T as follows:

t = [0 40 80 120 170 220 270];
val = rand(1, 7);
T = min(t):30:max(t);
Method = 'pchip'; % or whatever you prefer
vq = interp1(t, val, T, Method);

This is how the output, vq, looks like:

enter image description here

1

It seems that this is a process control system, you should use symulink for this thinks:

http://es.mathworks.com/company/newsletters/articles/modeling-industrial-chemical-processes-with-matlab-and-simulink-at-hugo-petersen-gmbh.html

this is a pdf tutorial for process control:

http://homepages.lboro.ac.uk/~cgzkn/processcontrol/simulink4controlnewsinglepage.pdf

comming to your question, in matlab you could use resample,( also be careful of the aliasing of the signal), in your case

y = resample(x,p,q) resamples the input sequence, x, at p/q times the original sample rate. If x is a matrix, then resample treats each column of x as an independent channel. resample applies an antialiasing FIR lowpass filter to x and compensates for the delay introduced by the filter.

so you have a signal that you need to resample by a factor of 30 fs1/fs2 ((1/60) / (1/(60*30)) = 30, in this case you could do something like this:

OutputResampled = resample(outputSignal,30,1)
1
  • What does Simulink have to do with the question…? Oct 1, 2016 at 15:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.