How to input this vector in simulink ?

2 visualizzazioni (ultimi 30 giorni)
Antônio Carvalho
Antônio Carvalho il 26 Mag 2022
Commentato: Jon il 26 Mag 2022
How could i input this vector phi in simulink, to see the graphic in a scope? Consider the time vector for each point of the phi vector .
phi = [15.4618463574325;17.9320433091703;20.1277739329371;22.1862713927186;24.5192351804709;25.6171004923543;26.4404994762669;26.5777326402523;25.6171004923543;23.9703025245292;22.1862713927186;18.6182091290974;16.8341779972868;15.4618463574325;13.8150483896074;11.3448514378696;9.97251979801534;7.77678917424846;5.71829171446701;3.38532792671470;1.73852995888955;-0.0455011729210426;-1.82953230473163;-3.88802976451308;-5.67206089632366;-6.63269304422167;-7.04439253617796;-5.80929406030910;-3.75079660052764;-1.14336648480448;1.60129679490412;3.79702741867099;6.12999120642331;8.87465448613190;10.5214524539571;11.2076182738842;10.5214524539571;8.05125550221932;5.85552487845244;4.48319323859814;1.87576312287498;0.228965155049821;-0.731666992848187;-0.731666992848187;-0.319967500891895;1.05236413896240;2.69916210678756;4.48319323859814;5.58105855048159;6.54169069837960;8.32572183019018;10.2469861259862;11.4820846018551;13.1288825696802;14.3639810455491;15.4618463574325;16.4224785053305;15.8735458493888;14.2267478815637;12.8544162417094;10.9331519459134;7.22785651830674;5.03212589453987;1.87576312287498;0.366198319035249;-1.96676546871706;-3.61356343654222;-5.67206089632366;-7.86779152009054;-9.78905581588656;-11.5730869476971;-13.3571180795077;-12.9454185875514;-11.2986206197263;-9.65182265190113;-7.86779152009054;-6.08376038827995;-4.84866191241109;-4.57419558444022;-5.26036140436738;-6.90715937219253;-8.55395734001769;-8.96565683197398;-8.82842366798855;-8.00502468407597;-6.08376038827995;-4.02526292849851;-2.51569812465878;-1.14336648480448;0.640664647006112;2.28746261483127;4.07149374664186;5.16935905852530;3.93426058265642;0.503431483020677;-2.92739761661507;-5.80929406030910;-11.7103201116826;-13.7688175714640;-14.5922165553766;-14.7294497193620;-13.4943512434932;-11.7103201116826;-10.0635221438574;-8.55395734001769;-6.63269304422167;-3.75079660052764;-0.868900156833622;1.05236413896240;2.56192894280213;4.20872691062728;5.16935905852530;5.58105855048159;5.16935905852530;3.65979425468557;0.915130974976968;-2.10399863270249;-3.75079660052764;-6.22099355226539;-8.27949101204683;-11.1613874557409;-13.9060507354495;-16.3762476871872;-19.3953772948666;-21.8655742466044;-23.6496053784150;-25.4336365102256;-26.6687349860944;-27.3549008060216;-27.3549008060216;-25.9825691661673;-24.4730043623276;-22.9634395584878;-19.9443099508084;-17.4741129990706;-15.6900818672600;-13.0826517515369;-9.51458948791569;-6.49545988023623;-3.75079660052764;-0.182734336906460]';
t = [[0.0146635397285680;0.106152315718853;0.0604079277237106;0.243385479704283;0.289129867699426;0.289129867699426;0.426363031684856;0.563596195670286;0.700829359655717;0.838062523641147;0.929551299631432;1.06678446361686;1.11252885161201;1.20401762760229;1.20401762760229;1.29550640359258;1.24976201559743;1.43273956757801;1.38699517958287;1.56997273156344;1.61571711955858;1.56997273156344;1.61571711955858;1.75295028354401;1.84443905953430;2.07316099951001;2.30188293948573;2.43911610347116;2.57634926745659;2.71358243144202;2.80507120743231;2.98804875941288;3.12528192339831;3.35400386337403;3.44549263936431;3.62847019134489;3.90293651931575;4.17740284728660;4.36038039926718;4.45186917525747;4.63484672723804;4.86356866721376;5.09229060718947;5.32101254716519;5.59547887513605;5.77845642711662;6.09866714308262;6.51036663503891;6.92206612699520;7.01355490298549;7.28802123095635;7.56248755892721;7.60823194692235;7.83695388689807;8.01993143887864;8.15716460286407;8.29439776684950;8.66035287081065;8.75184164680093;8.84333042279122;8.93481919878150;9.25502991474751;9.39226307873294;9.39226307873294;9.52949624271837;9.62098501870865;9.62098501870865;9.66672940670380;9.84970695868437;9.84970695868437;10.0326845106649;10.2156620626455;10.6273615546018;10.7645947185872;10.9475722705678;11.0848054345532;11.4050161505192;11.4965049265095;11.8167156424755;11.9996931944561;12.1826707464367;12.5486258503978;12.7773477903735;13.0518141183444;13.1890472823298;13.2805360583201;13.4177692223055;13.5092579982958;13.6464911622813;13.7837243262667;13.9667018782473;14.0581906542376;14.2411682062181;14.5156345341890;14.8358452501550;14.9730784141404;15.0645671901307;15.4305222940919;15.4305222940919;15.6592442340676;15.9337105620384;16.1166881140190;16.2081768900093;16.3454100539947;16.4368988299850;16.4826432179801;16.6198763819656;16.7571095459510;16.8485983219413;16.8028539339461;16.9858314859267;17.1688090379073;17.3060422018927;17.5347641418684;17.5805085298636;17.6719973058539;17.8092304698393;17.8549748578344;18.0379524098150;18.0836967978102;18.1751855738004;18.1294411858053;18.2666743497907;18.3581631257810;18.4039075137762;18.5868850657567;18.6326294537519;18.6326294537519;18.7241182297422;18.8613513937276;18.9528401697179;19.0900733337033;19.1815621096936;19.2730508856839;19.2730508856839;19.3187952736790;19.4560284376645;19.5017728256596;19.5475172136547;19.6390059896450;19.7762391536305]]';

Risposte (2)

Fangjun Jiang
Fangjun Jiang il 26 Mag 2022
Use the "From Workspace" block, specify the data as [t', phi'], connect it to a Scope.
But the value in "t" is not incremental, so you might try t=0:10, phi=0:10 first and then fix the value in your "t".

Jon
Jon il 26 Mag 2022
In general for this situation you could use a From Workspace block (in sources library) , where you would assign the input matrix with the first column as your time vector and the second column as your phi vector. So in your MATLAb workspace (command line or in a script) assign
t = [0.0146635397285680;0.10615 ...
phi = [15.4618463574325;17.9320433091703;...
inputSignal = [t phi];
or just assign it directly in the dialog box like this
However you have a problem, which is that your time vector needs to be strictly increasing, and yours occassionally reverses.
You will have to determine why this is and provide a valid (increasing time) to go with you phi vector.
  2 Commenti
Jon
Jon il 26 Mag 2022
Oh it looks like @Fangjun Jiang had posted something similar while I was still working on my reply to you. (You don't see this until after you submit your answer)
Jon
Jon il 26 Mag 2022
Also I had a little confusion over the dimensions of the t and phi vectors. They should be entered as columns. I hadn't noticed that in your assignment you had put in a transpose at the end.

Accedi per commentare.

Categorie

Scopri di più su Simulink Environment Customization in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by