# Animated Vectors Plot with data coming from Simulink

2 visualizzazioni (ultimi 30 giorni)
Graziano Ullucci il 28 Lug 2011
[EDIT: 20110729 12:11 CDT - reformat - WDR]
I've been able to do this:
for t=1:360
hold on
corda=0.3;
r=0.3;
a=0;
b=0.2;
c=0.2;
d=0;
e=0.2;
f=0.2;
g=-0.2;
h=-0.2;
z=(-1*(r+corda));
x=(r+corda);
axis([z x z x]);
Dpercent=[0.00,1.25,2.50,5.00,7.50,10.00,15.00,20.00,30.00,40.00,50.00,60.00,70.00,80.00,90.00,95.00,100.00,100.00,95.00,90.00,80.00,70.00,60.00,50.00,40.00,30.00,20.00,15.00,10.00,7.50,5.00,2.50,1.25,0.00];
x=corda.*((Dpercent-25.00)./100);
Ypercent=[0.00,2.37,3.27,4.44,5.25,5.85,6.68,7.17,7.50,7.25,6.62,5.70,4.58,3.28,1.81,1.01,0.16,-0.16,-1.01,-1.81,-3.28,-4.58,-5.70,-6.62,-7.25,-7.50,-7.17,-6.68,-5.85,-5.25,-4.44,-3.27,-2.37,0.00];
y=r+(corda.*(Ypercent./100));
X=x.*cos(t*(2*pi)/360)-y.*sin(t*(2*pi)/360);
Y=x.*sin(t*(2*pi)/360)+y.*cos(t*(2*pi)/360);
plot(X,Y);
r1=0.*cos(t*(2*pi)/360)-r.*sin(t*(2*pi)/360);
r2=0.*sin(t*(2*pi)/360)+r.*cos(t*(2*pi)/360);
R1=[0,r1];
R2=[0,r2];
plot(R1,R2);
quiver(r1,r2,a,b);
quiver(r1,r2,c,d);
quiver(r1,r2,e,f);
quiver(r1,r2,g,h);
M(t)=getframe
clf
end
movie(M);
Now I need to esport simulation data from simulink to matlab's workspace.
I used the block "simout to workspace" I tryed to specify that I need a simple ARRAY variable type but it LOVES to SAVE MY DATA AS:
simout <1x1x64 double>
I need a simple array made of 64 elements with my numerical value inside. My model is costant time division made so I don't need time information.
(Anyway could be usefull in tre future to know wow to obtain a two rows 64 coloumn matrix with a row for time and a row for values)
I don't know how to build a simple array from my
simout <1x1x64 double>
For exemple to use it for defining the vectors component in the animation.
I need a simple exemple of script in which you take an array made like myne (simout double coming from "simout to workspace" setted like "ARRAY" type) and use it to plot it:
Wrong exemple:
A=[1:64];
plot(A,simout);
That exemple doesn't work....
How to make it run?
Does anybody knows?
thankyou.
##### 1 CommentoMostra -1 commenti meno recentiNascondi -1 commenti meno recenti
Walter Roberson il 29 Lug 2011

Accedi per commentare.

### Risposte (3)

Graziano Ullucci il 29 Lug 2011
This script work but, anybody knows a faster way tho download the values ftom simout into A?
A=[simout(:,:,1),simout(:,:,2),simout(:,:,3),simout(:,:,4) ------------ simout(:,:,500]; B=[1:500]; Plot(B,A);
Probably it is not very difficult someone can help me?
##### 1 CommentoMostra -1 commenti meno recentiNascondi -1 commenti meno recenti
Fangjun Jiang il 29 Lug 2011
A=simout(:,:,1:500);

Accedi per commentare.

Graziano Ullucci il 29 Lug 2011
For exemple this doesn't work
B=[1:500]; A=[VwrX(:,:,B)]; plot(B,A);
It is faster but don't work. suggestions?
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

Graziano Ullucci il 29 Lug 2011
That's Work grate!
A=length(simout);
B=[1:A];
ArrayOUT(1,B)=simout(:,:,B);
thank You Myself! you're Grate!
##### 1 CommentoMostra -1 commenti meno recentiNascondi -1 commenti meno recenti
Fangjun Jiang il 29 Lug 2011
Be careful, length() is equal to max(size()). It may not be the number you want.

Accedi per commentare.

### Categorie

Scopri di più su Modeling in Help Center e File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by