How can I plot the fft of a torque signal from simulink?

I want to plot the fft of the torque waveform that I obtain from Simulink in from 0.5s to 1s. I have the time array and the torque array but the sample step is not homogeneous. I have tried to discretize the torque by using delay and so having the same sample step but it really slows my simulation so I need to use variable step. I would like to know how to obtain in an easy way the harmonic content of the following signal:
r=find(torque.time>= 0.5 & torque.time<= 1); plot(torque.time(r),torque.signals.values(r)); timesim=(torque.time(r)); %1x673 torquesim=(torque.signals.values(r)); %1x673
torquesim= [46.1075152808528 46.1075436322296 46.1075934164804 46.1076432009408 46.1076929856262 46.1077427705538 46.1077925557160 46.1078595784897 46.1079477122389 46.1080358465634 46.1081239814094 46.1082417296371 46.1083594787239 46.1085684779717 46.1091532834247 46.1097381099678 46.1103229575235 46.1112002680397 46.1120776253737 46.1133937486221 46.1147099758724 46.1165069905329 46.1183041954988 46.1210003551979 46.1236969317822 46.1277425631066 46.1317890948029 46.1378605304829 46.1439338684488 46.1677152735873 46.1915208076147 46.2153473409379 46.2421682890254 46.2690180901965 46.2829669879802 46.2924129250715 46.2989683827304 46.3034572114448 46.3079569319853 46.3102403511590 46.3125310989621 46.3138957089359 46.3152663592675 46.3161711729579 46.3170818923648 46.3176897401430 46.3183034850002 46.3187203209313 46.3191432478446 46.3193897264550 46.3196404883689 46.3198380931267 46.3199772383485 46.3201195068677 46.3202659557154 46.3203796174783 46.3204975416532 46.3205833884035 46.3206727577234 46.3207446737585 46.3207684800585 46.3207926466788 46.3208171986516 46.3208314723536 46.3208458801468 46.3208604194089 46.3208750865266 46.3208903063261 46.3209056599931 46.3209211504522 46.3209422450954 46.3209635934958 46.3209807283333 46.3210080805480 46.3210275584973 46.3210472307338 46.3210740413081 46.3210948071250 46.3211157769553 46.3211438178628 46.3211722177294 46.3212009800601 46.3212301030252 46.3212670768945 46.3212962925633 46.3213327144250 46.3213696560951 46.3214071137383 46.3214450874291 46.3214915381430 46.3215387409158 46.3216148062599 46.3216927444201 46.3217531672513 46.3218146667633 46.3219045388891 46.3219966144588 46.3220908928593 46.3221873729180 46.3222860526619 46.3224552777705 46.3226964491380 46.3229489886349 46.3233637130343 46.3242871411923 46.3253221384820 46.3264682263622 46.3277249298823 46.3290917777093 46.3305683020827 46.3325378181887 46.3346722995033 46.3369709031762 46.3402264822501 46.3437599784776 46.3487570217810 46.3542150339777 46.3615677142166 46.3696069522662 46.3783256597181 46.3877169521446 46.3977740201141 46.4121577861774 46.4325132606759 46.4547668384289 46.4788870844608 46.5048436044519 46.5384968293978 46.5747205562606 46.6134669313178 46.6546899929298 46.6983455173827 46.7554156354594 46.8160380381303 46.8801403078665 46.8803494852780 46.8805586971232 46.8814260368412 46.8824741180942 46.8838404834603 46.8857586830392 46.8888229619219 46.8950499135314 46.8950499137068 46.8983694596732 46.9016974122265 46.9075320043891 46.9133921900067 46.9221207441701 46.9430099308585 46.9642108777917 47.0018271543327 47.0485245452436 47.1128149908067 47.1794472813610 47.3148549268651 47.4586571112528 47.6106321837152 47.7705752559241 47.9382969150976 48.1136220302107 48.2963887827995 48.4864472170211 48.7357486831357 48.9961229476179 49.3831038291034 49.8760485222406 50.3986342855447 50.9500960673457 51.4155467551621 51.4155467553900 52.0175537635134 52.0188871457091 52.0202206554753 52.0234488725042 52.0276766960688 52.0339691967418 52.0451427884090 52.0762025817574 52.2044834349431 52.8631035917319 54.0704776884064 55.8266723318428 57.7286164529613 59.7723342941302 62.4490915081935 65.3248925990954 69.6869332407216 75.6272804147742 82.1010611482982 89.0761769915824 100.396841833572 115.410185704165 136.321701634315 165.387513648229 196.309567440403 228.433494603929 261.216990372411 281.181036441877 281.181036443495 281.181292767279 281.181549091068 281.181805414865 281.182324966594 281.183824829584 281.188782863252 281.193740897719 281.198698932978 281.203656969029 281.208615005877 281.215766047032 281.222917089832 281.230068134275 281.239679198217 281.249290265118 281.258901334968 281.273172073772 281.292899919792 281.320024172202 281.347148447715 281.381750416026 281.433182497334 281.558391826262 281.973231560744 283.224297643312 286.755234483122 289.112305958578 291.469254068280 294.508069985287 303.653520014147 311.691897080888 314.440211460724 315.839223001213 315.839223002721 315.839223003561 315.849961350060 315.860699678853 315.882261540120 315.903823329960 315.940363543266 315.940363544105 316.015588107546 316.071660956961 316.154362850208 316.348186593336 316.542004505902 317.225532147785 318.255058741518 320.028630462206 322.228867924721 325.033520804250 326.671337542777 328.308661831764 328.309426641828 328.310191451782 328.314015499896 328.320091991052 328.326168475171 328.334622326004 328.345178898359 328.359207921562 328.379560162601 328.414101780989 328.497433894200 328.666991271953 329.140893225392 329.614752848388 330.088569897353 330.818664414376 332.255146852541 334.736085010873 337.784756316094 341.568600980148 346.117542803558 351.672913923928 358.446458502464 365.209337900339 371.961611179190 383.095113451346 392.461989217479 392.461989218306 392.864082644682 393.266145670532 394.984175238727 401.230762668122 423.155793782207 434.794547957503 446.432271163234 469.110800573849 505.611751526126 516.659763340328 527.770431227186 559.046865050948 610.030888832224 625.744427919113 641.669274431728 670.527403802016 718.921966233190 768.791376631207 819.609501587636 834.941907986672 850.270087468117 861.787865399785 873.277983545278 906.160006451511 938.438451875981 969.833898737461 1000.07520422446 1028.90925444138 1056.10940399030 1088.85702835509 1118.16500438057 1143.82698543854 1165.76152593804 1184.00484510135 1198.69589953058 1210.05601033038 1218.36523922513 1223.93748958000 1227.09639346634 1228.15370511425 1227.39146462448 1224.25369372199 1219.00231977427 1211.86069612517 1202.93496832261 1192.23989952476 1179.73511496488 1165.36624777226 1149.10502953069 1130.98267535532 1125.19562047735 1119.25460527150 1107.47926103883 1091.02673515160 1073.82324919171 1067.82870707849 1067.82870707806 1066.25371312216 1064.67455629271 1056.72108513917 1035.79715584216 1014.55969274607 993.260186492026 972.122518097346 944.203572393698 917.169159782315 891.090598044472 865.840462262982 841.128690668752 816.561004177066 791.709412748644 766.183340592207 739.690859378492 711.976918300214 683.150726455448 653.386007808814 622.993702524226 592.383273023761 562.017401957432 532.368355123674 494.688272622626 460.001289706591 435.793816541439 414.134263529853 395.313341268854 379.631825216225 367.419507536482 359.043093131190 354.900492891650 355.401725312807 360.939074670741 371.851248317911 388.387267313349 410.675162746655 447.509771874077 493.303369996101 547.264416620162 608.260142121912 674.895617352740 745.598952156855 818.695982239289 892.465337510822 965.173798767953 1035.09934699627 1100.55308922710 1159.91047774701 1221.30895573975 1277.89106610362 1305.45661389828 1319.14131706127 1318.75663739698 1304.67205528076 1263.25704333619 1200.09905788821 1140.42034948190 1073.27542722281 1001.08303628664 926.272425518306 825.313620990459 729.410076229331 643.336302247620 570.744014550989 513.877183724626 473.517358040199 449.197823169249 439.609008179399 443.048579343707 457.783418671029 488.912424080620 532.335669232655 569.492053620759 611.380422447012 657.568364279370 707.635995384200 761.095376237021 817.293434852575 875.317986494957 933.931197131296 1011.53137958810 1082.39852422411 1141.11982440639 1182.29129237413 1199.27938748900 1200.62385565676 1185.26844049799 1153.01445589981 1088.98130934755 1002.86938723189 900.848089597506 790.834091689773 681.654041691133 582.090324311136 499.963625291290 441.371602550151 410.155229799838 407.629312028993 432.593805718251 481.620114985507 549.571366667414 572.811628506759 597.025604775157 622.034006760675 647.658585547608 673.723713354994 679.372695206967 685.032405592873 690.500894282520 695.976331000712 719.852835765899 743.715065631001 845.068581230132 918.319241256678 982.066520966032 1034.28565903557 1073.80144619063 1100.11123642660 1113.18264536289 1113.27124515127 1099.44214167430 1071.85090611834 1031.34393123252 979.089929554421 916.758371601051 846.690811112443 772.009412283386 696.614938483309 625.042830974868 548.845888901422 495.124269304391 471.247600751822 481.542946353781 526.290080008464 601.353647277559 698.565278378127 806.806041860520 913.594728402002 1006.88585244715 1076.74170012353 1116.57928430881 1123.80142348777 1099.75567235898 1049.10390573157 978.794345598958 896.884592415756 811.460782973076 746.857932433417 687.616348180253 636.202458907149 594.573371539218 564.219782844176 543.873481928588 542.811135563741 559.169723473341 592.360847559158 640.858780975020 702.073064628614 772.295582400050 846.782043938445 920.004184702355 986.072588449018 1049.11945652332 1084.04171621363 1085.52746506497 1052.79342926286 989.916986615910 905.287212486460 810.271821402109 717.380220423724 638.306850780493 582.244858346032 554.770172925558 557.437656593987 588.058364538018 656.831269935422 714.447629377141 776.913649808474 839.937108979668 899.465186102180 951.837765115363 993.895707912195 1023.07177549521 1038.36602040963 1019.64574686375 974.846770427423 923.992798486703 863.381663198876 797.699003212870 732.315908909876 672.827759642510 614.518659722447 582.106123312118 589.427444597451 656.842135404843 733.802838350925 820.161821285877 902.411418168821 968.424016602222 1009.32810741335 1020.58303237817 1002.17784752602 940.742121062175 879.998680532101 812.762816123095 746.452840169792 688.195630668140 644.247812066447 616.948151766443 619.526088666543 645.610517816558 692.371433513922 754.257252366167 823.532576498378 891.217984418798 948.323443210864 987.180485210462 1002.23160730831 979.054993578578 926.251530386533 854.267433107674 776.704326218193 707.508995597947 658.360359613972 636.786013547009 645.257869649729 675.131948841122 721.519352740800 778.348036128026 838.487912074915 894.527490792825 939.567561714181 967.992671487640 972.801122628228 934.058746541717 882.835398834545 820.900168522068 757.898033835768 703.733798503590 666.900535496477 653.433082383329 675.061055025009 724.313614666576 790.174109263843 858.617365240010 905.458373771537 939.379806536041 956.499843551102 950.066147369508 922.533694108569 879.737065891791 827.946272907788 774.566710698911 727.172492227690 692.503478193753 674.412237652747 686.178912120282 723.317771084770 778.208312395644 839.506133446284 894.534403136993 932.034176536621 944.600061201090 915.419307156766 864.493540911907 802.636656365005 756.471591185601 719.551049182833 696.997701189670 693.573535825170 713.103994023172 749.405259528772 796.097839650398 845.142486589334 888.160195077776 917.823277549479 928.672454151416 911.145529601663 872.068842227041 820.485967613775 768.217819616302 727.089871518203 706.177850294324 714.391009516817 756.374595692056 802.913515399613 850.734616395459 889.862873259072 912.412642029358 911.272269661356 879.368316209907 839.187538813477 794.614919618699 754.685871828256 727.427176566040 719.014333406976 736.227504249832 771.962520766749 817.343122323297 861.269178256599 893.184925211747 905.668567217087 882.990011190091 842.206308110499 794.466190203108 760.871052343303 738.129840627273 730.932262766106 745.284429113238 775.298363526396 813.911194902503 852.215109845911 881.483056948403 895.152481872468 887.526588465179 857.254198062359 814.408894561392 772.891102667913 745.875722579876 741.595517765094 757.830489182626 788.423581024848 825.306938470487 859.032493471362 881.179094914996 886.425362812779 873.487084839290 845.872387990655 811.039309380438 778.200214326504 755.907710472980 750.888832291467 766.736518860812 796.257024899556];
timesim=[0.500000058193560 0.500000142119905 0.500000289491873 0.500000436863841 0.500000584235809 0.500000731607778 0.500000878979746 0.500001077376725 0.500001338263528 0.500001599150332 0.500001860037136 0.500002208579853 0.500002557122569 0.500003175763728 0.500004906755008 0.500006637746289 0.500008368737570 0.500010965224491 0.500013561711412 0.500017456441794 0.500021351172176 0.500026668065175 0.500031984958173 0.500039960297672 0.500047935637170 0.500059898646418 0.500071861655665 0.500089806169537 0.500107750683408 0.500177966483432 0.500248182283455 0.500318398083479 0.500397369520664 0.500476340957850 0.500517316994638 0.500545029082570 0.500564231595705 0.500577357382570 0.500590483169435 0.500597124951111 0.500603766732787 0.500607708328662 0.500611649924537 0.500614238081038 0.500616826237540 0.500618540118718 0.500620253999896 0.500621404420259 0.500622554840622 0.500623214542478 0.500623874244334 0.500624383382958 0.500624734596678 0.500625085810398 0.500625437024118 0.500625700819404 0.500625964614690 0.500626149306482 0.500626333998274 0.500626476419052 0.500626522268126 0.500626568117201 0.500626613966276 0.500626640281766 0.500626666597257 0.500626692912747 0.500626719228238 0.500626746299866 0.500626773371494 0.500626800443122 0.500626836922605 0.500626873402088 0.500626902378095 0.500626948101663 0.500626980275978 0.500627012450294 0.500627055792166 0.500627088975881 0.500627122159595 0.500627166039294 0.500627209918994 0.500627253798693 0.500627297678392 0.500627352628745 0.500627395471030 0.500627448189011 0.500627500906993 0.500627553624974 0.500627606342956 0.500627669872300 0.500627733401644 0.500627833722887 0.500627934044130 0.500628010211902 0.500628086379673 0.500628195365384 0.500628304351095 0.500628413336806 0.500628522322517 0.500628631308228 0.500628812817365 0.500629060925997 0.500629309034628 0.500629694376698 0.500630474689183 0.500631255001668 0.500632035314153 0.500632815626638 0.500633595939124 0.500634376251609 0.500635337756705 0.500636299261802 0.500637260766898 0.500638519420220 0.500639778073542 0.500641411550490 0.500643045027438 0.500645057613672 0.500647070199906 0.500649082786141 0.500651095372375 0.500653107958609 0.500655782565422 0.500659250153263 0.500662717741104 0.500666185328945 0.500669652916786 0.500673828802285 0.500678004687783 0.500682180573282 0.500686356458780 0.500690532344279 0.500695677558918 0.500700822773558 0.500705967988197 0.500705984338027 0.500706000687857 0.500706068441464 0.500706150252441 0.500706256807161 0.500706406204328 0.500706644400559 0.500707126707079 0.500707126707092 0.500707382881662 0.500707639056232 0.500708086632476 0.500708534208719 0.500709197273092 0.500710767201796 0.500712337130500 0.500715068024020 0.500718368315201 0.500722765083324 0.500727161851446 0.500735667210597 0.500744172569747 0.500752677928898 0.500761183288048 0.500769688647199 0.500778194006349 0.500786699365499 0.500795204724650 0.500805907352811 0.500816609980971 0.500831757612973 0.500849960805524 0.500868163998075 0.500886367190626 0.500901051690918 0.500901051690926 0.500919254883476 0.500919294302021 0.500919333720565 0.500919429131040 0.500919554051660 0.500919739907803 0.500920069726392 0.500920985159789 0.500924744808964 0.500943543054841 0.500976097114911 0.501019929587712 0.501063762060514 0.501107594533315 0.501161007293490 0.501214420053664 0.501289415260741 0.501382826321524 0.501476237382307 0.501569648443091 0.501709660531145 0.501879777576642 0.502097235482662 0.502376074774283 0.502654914065904 0.502933753357526 0.503212592649147 0.503381194699620 0.503381194699634 0.503381196861819 0.503381199024005 0.503381201186190 0.503381205568800 0.503381218220696 0.503381260043528 0.503381301866360 0.503381343689193 0.503381385512025 0.503381427334857 0.503381487656462 0.503381547978066 0.503381608299670 0.503381689372392 0.503381770445115 0.503381851517837 0.503381971896444 0.503382138307544 0.503382367109682 0.503382595911820 0.503382887790463 0.503383321635902 0.503384377812309 0.503387877076663 0.503398429882398 0.503428212727827 0.503448094418673 0.503467976109518 0.503493612274814 0.503570797817775 0.503638698310863 0.503661929591438 0.503673758920536 0.503673758920549 0.503673758920556 0.503673849728219 0.503673940535882 0.503674122872177 0.503674305208472 0.503674614210504 0.503674614210511 0.503675250351922 0.503675724540415 0.503676423928914 0.503678063081190 0.503679702233465 0.503685483344223 0.503694192012580 0.503709197901256 0.503727819920708 0.503751567800553 0.503765441217277 0.503779314634002 0.503779321115395 0.503779327596789 0.503779360003755 0.503779411499141 0.503779462994526 0.503779534637091 0.503779624099434 0.503779742989563 0.503779915466901 0.503780208195244 0.503780914414229 0.503782351405383 0.503786367945879 0.503790384486374 0.503794401026869 0.503800590738212 0.503812771719036 0.503833817487534 0.503859693741692 0.503891832817329 0.503930505231533 0.503977787051741 0.504035518396913 0.504093249742084 0.504150981087256 0.504246363247302 0.504326784130039 0.504326784130046 0.504330239727482 0.504333695324918 0.504348464116764 0.504402199652024 0.504591167251406 0.504691625823476 0.504792084395546 0.504987552467696 0.505299912785693 0.505393620881092 0.505487328976492 0.505747691127277 0.506159408180849 0.506282923296921 0.506406438412993 0.506626156214656 0.506984001395813 0.507341846576971 0.507699691758129 0.507807045312476 0.507914398866824 0.507995188930481 0.508075978994139 0.508309073426839 0.508542167859540 0.508775262292240 0.509008356724941 0.509241451157641 0.509474545590342 0.509779019702771 0.510083493815200 0.510387967927629 0.510692442040058 0.510996916152487 0.511301390264916 0.511605864377345 0.511910338489774 0.512214812602203 0.512519286714632 0.512823760827061 0.513128234939490 0.513507942409593 0.513887649879695 0.514267357349797 0.514647064819900 0.515026772290002 0.515406479760104 0.515786187230206 0.516165894700309 0.516545602170411 0.516659514411442 0.516773426652473 0.516991392077155 0.517281831402243 0.517572270727331 0.517670993109718 0.517670993109725 0.517696758030574 0.517722522951423 0.517851347555666 0.518184545379694 0.518517743203722 0.518850941027750 0.519184138851777 0.519633209210946 0.520082279570115 0.520531349929283 0.520980420288452 0.521429490647621 0.521878561006789 0.522327631365958 0.522776701725127 0.523225772084295 0.523676514596763 0.524127257109230 0.524577999621698 0.525028742134165 0.525479484646633 0.525930227159101 0.526380969671568 0.526982695029703 0.527584420387837 0.528048184313922 0.528511948240007 0.528975712166091 0.529439476092176 0.529903240018260 0.530367003944345 0.530830767870430 0.531294531796514 0.531758295722599 0.532222059648683 0.532685823574768 0.533149587500853 0.533742676007783 0.534335764514714 0.534928853021645 0.535521941528575 0.536115030035506 0.536708118542436 0.537301207049367 0.537894295556298 0.538487384063228 0.539080472570159 0.539673561077090 0.540266649584020 0.540983094211633 0.541858082990959 0.542517479316065 0.543176875641171 0.543836271966278 0.544495668291384 0.545427773194876 0.546359878098367 0.547068231160278 0.547776584222188 0.548484937284099 0.549193290346010 0.550150679999843 0.551108069653675 0.552065459307508 0.553022848961340 0.553980238615173 0.554937628269005 0.555895017922838 0.556852407576670 0.557809797230503 0.558767186884335 0.559939012011744 0.561110837139153 0.561939642393057 0.562768447646960 0.563597252900864 0.564426058154768 0.565254863408672 0.566083668662575 0.566912473916479 0.567741279170383 0.568867467454305 0.569993655738228 0.571119844022151 0.572246032306073 0.573133561867969 0.574021091429865 0.574908620991760 0.575796150553656 0.576924598948749 0.578053047343842 0.579181495738935 0.580309944134029 0.581438392529122 0.582566840924215 0.583695289319308 0.584823737714401 0.585952186109494 0.587080634504587 0.588209082899680 0.589337531294773 0.590465979689866 0.590804514208394 0.591143048726922 0.591481583245450 0.591820117763978 0.592158652282506 0.592231471683625 0.592304291084744 0.592374539389812 0.592444787694880 0.592750598506032 0.593056409317185 0.594396036776305 0.595455388941043 0.596514741105781 0.597574093270519 0.598633445435257 0.599692797599995 0.600752149764732 0.601811501929470 0.602946351617801 0.604081201306132 0.605216050994463 0.606350900682793 0.607485750371124 0.608620600059455 0.609755449747786 0.610890299436116 0.612025149124447 0.613436537268735 0.614847925413023 0.616259313557311 0.617670701701598 0.619082089845886 0.620493477990174 0.621904866134462 0.623316254278749 0.624727642423037 0.626139030567325 0.627550418711613 0.628961806855900 0.630373195000188 0.631784583144476 0.633195971288764 0.634607359433051 0.636018747577339 0.637430135721627 0.638534636904763 0.639639138087899 0.640743639271036 0.641848140454172 0.642952641637308 0.644315423978420 0.645581342170397 0.646847260362374 0.648113178554352 0.649379096746329 0.650645014938306 0.651910933130283 0.653176851322261 0.654442769514238 0.655708687706215 0.657267373994089 0.658826060281963 0.660384746569837 0.661943432857711 0.663502119145585 0.665060805433460 0.666619491721334 0.668178178009208 0.669736864297082 0.671295550584956 0.672854236872830 0.674412923160704 0.675971609448578 0.677906775254242 0.679171078955782 0.680435382657322 0.681699686358861 0.682963990060401 0.684228293761940 0.685492597463480 0.686756901165020 0.688843404128874 0.690506642374240 0.692169880619605 0.693481318047168 0.694792755474730 0.696104192902292 0.697415630329854 0.698727067757416 0.700377327849300 0.702027587941185 0.704417764141851 0.706807940342517 0.708563959588874 0.710319978835231 0.712075998081589 0.713832017327946 0.715588036574303 0.717344055820660 0.719100075067018 0.721395468856487 0.723003308633233 0.724611148409979 0.726218988186725 0.727826827963471 0.729434667740218 0.731395448259474 0.733041885927999 0.734688323596524 0.736334761265049 0.737981198933574 0.739627636602099 0.741274074270624 0.742920511939149 0.744566949607674 0.746742375275530 0.748683600019408 0.750624824763286 0.752566049507163 0.754507274251041 0.756448498994919 0.758389723738797 0.760330948482675 0.762272173226553 0.763954783282015 0.765637393337477 0.767320003392939 0.769002613448401 0.770685223503863 0.772367833559325 0.774050443614787 0.776501681580751 0.778952919546716 0.780763126899283 0.782573334251851 0.784383541604418 0.786193748956985 0.788003956309553 0.790266975548438 0.792371944051573 0.794476912554707 0.796581881057841 0.798686849560975 0.800351630250867 0.802016410940758 0.803681191630650 0.805968086145757 0.807752499191227 0.809536912236697 0.811321325282167 0.813105738327637 0.814890151373107 0.816674564418577 0.818918216203972 0.821013945951379 0.823109675698787 0.825205405446194 0.827301135193601 0.829396864941008 0.831492594688415 0.833588324435822 0.836672765521580 0.838971971559299 0.841271177597017 0.843060345210822 0.844849512824626 0.846638680438431 0.848956323872568 0.850902596754033 0.852848869635498 0.854795142516963 0.856741415398428 0.858687688279893 0.860633961161358 0.863113149020064 0.865324244368412 0.867535339716760 0.869746435065109 0.871957530413457 0.874168625761806 0.876379721110154 0.879152200173624 0.881924679237095 0.884073738898868 0.886222798560641 0.888371858222414 0.890520917884187 0.893206342665399 0.895891767446611 0.898005066846593 0.900118366246576 0.902231665646558 0.904344965046540 0.906975875209955 0.909272573882374 0.911569272554793 0.913865971227212 0.916162669899632 0.918459368572051 0.920756067244470 0.924316383794816 0.926880508730027 0.929444633665239 0.931483169981151 0.933521706297064 0.936101530078016 0.938350575987638 0.940599621897260 0.942848667806882 0.945097713716504 0.947346759626126 0.949595805535747 0.952258504160944 0.954921202786141 0.957583901411338 0.960246600036535 0.962909298661732 0.965571997286929 0.967945711260788 0.970319425234646 0.972693139208504 0.975066853182363 0.977440567156221 0.979814281130080 0.982224460135398 0.984634639140717 0.987044818146035 0.989454997151353 0.991865176156672 0.994817219349793 0.997319860118425 0.999822500887057];
Find the torque courbe attached. I want to display the fft of that courbe (It has to be something like peaks on 35Hz and 60Hz)

Answers (1)

Well, the first thing you need to do is make sure that the output signal from Simulink is output at a fixed sampling rate. Furthermore, this rate should be sufficiently high enough that you can capture the 35 and 60 Hz peaks... so, your rate should be AT LEAST 120 Hz (though I'd go for higher).
You can do this by doing either of the following:
  1. Discretizing the signal with a Rate Transition block prior to exporting to the workspace.
  2. Going to Configuration Parameters > Data Import/Export and changing the Output options to "Produce specified output only" and an evenly sampled time vector of your choice. For example, 0.5:(1/120):1.
Once you have your evenly sampled data, you can follow the example on the fft documentation: http://www.mathworks.com/help/matlab/ref/fft.html
If you have a DSP System Toolbox license, you could alternative plot the FFT on a Spectrum Analyzer block: http://www.mathworks.com/help/dsp/ref/spectrumanalyzer.html
- Sebastian

1 Comment

Oh, I just re-read and saw that you didn't want to take all those time-steps because it slows down your simulation.
This may or may not work, but here's a 3rd alternative: Use the interp1 function on your data to interpolate the non-homogeneous data with an homogeneous sampling time of your choice.

Sign in to comment.

Tags

Community Treasure Hunt

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

Start Hunting!