How to store scalars(continuous data) as a vector

an embedded matlab function block1 outputs scalars instantaneously, a set of sequential scalar outputs (ex: minimum 3 or more outputs) has to be stored as a vector, embedded fcn block2 accepts vector input and compares the elements in it, how instantaneous scalars can be stored as a vetor

 Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 27 Oct 2012
Edited: Azzi Abdelmalek on 27 Oct 2012

15 Comments

input vector size of embedded fcn2 is fixed only.....when i give a dutycycle to my power electronic converter(simulink model), my solar module(embedded fcn blck1) gives a power(scalar),
i m sending three dutycycles(d1 d2 d3) one by one, simultaneously corresponding power P1 P2 P3 should be sensed. i wanna concatenateP=[ P1 P2 P3 ], ........P is given embedded fcn block2(Particle swarm optimizer controller) for further processing.
what is repmat..using tat real time data could be stored..?
you can see what repmat do, (help repmat), but it's not what you need, if I've understood what you need, is every step time you want concatenate p1, p2 and p3. Then what I suggest is to create a matlab function with one input(P1, then P2 then P3) sampled with ts and an output [P1 P2 P3] sampled with 3*ts. If it's what you want I will post a simulink model
yes i feel this s wat i want...i hope, i can give scalar output power in place of digitized sine-wave., or do i need to convert the scalar output to any digitized form ,
thanks a lot for this model, request you to post the simulink model..
i tried your simulink model, to check it i need to send three duty cycles (d1 d2 d3)to one terminal as mentioned earlier..d1 d2 d3 has to be sent one by one sequentially with delay,
tried with 1)multiport switch 2) mux delay combination.. dint work as desired..
Maybe you have'nt understood how it works,use the first input p1 to be sent to your desired block. at the same time the matlab function block is storing p1,p2,and p3 to be sent 3 ts after. What is the problem?
i understood the simulink model you sent, i simulated it seperately,it showed three values in P vector,[-0.9511 -0.5878 0], i took it as at 1st sample digital sine wave has the magnitude -0.9511,for 2nd sample mag is -0.5878.. so on..
>make me clear if i misunderstood
>at the input side without ZOH also, it showed same output, what's its specific purpose
Yes, but what is the problem?
no problem... jus wanted to know the purpose of ZOH
Ok, the zoh will maintain the same output during its sample time. where I've used a unit delay I did'nt add a zoh, because a unit delay do the same thing (plus delaying)
thank u, i hope u had kept a digitized sinewave earlier, now it seems to be a continuous one, in my model, my solar module sends continuous data of power
do i need to make any analog to digital conversion..?
Kumar, I can't answer this question, because I don't know what your program is doing.
k sir..the model u given is very much useful for me to develop my simulation model...
Sir,whether do i need a reset block to ZOH, whether will it store values for every sample...
Kumar, what do you mean?
my faculty raised this question, when ZOH1 holds the values of three sample, for the next sample time, will it hold the next sample value with out resetting,or wil it have the previous values stored before
I simulated the ZOH1 block with display1 in your model, kept a display2 before ZOH1,
I saw that display1 showed values before simulation finishes, values in display2 were changing,
how it could be interpreted...?

Sign in to comment.

More Answers (0)

Categories

Products

Community Treasure Hunt

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

Start Hunting!