Cov txheej txheem:
- Kauj ruam 1: Pib Matlab
- Kauj ruam 2: Tsim M-File
- Kauj Ruam 3: Tsim Lub Sijhawm Vector
- Kauj Ruam 4: Khiav thiab Teeb Duab Ua Haujlwm
- Kauj ruam 5: Rub cov ntaub ntawv los ntawm Excel
- Kauj Ruam 6: Tsim Specgram
Video: Matlab Basics: 6 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:31
Cov lus qhia no yuav npog qee qhov kev ua haujlwm yooj yim tshaj plaws ntawm matlab. Koj yuav kawm paub yuav ua li cas ua matlab ua haujlwm ib ntus hauv tsev thiab cov phiaj xwm thiab yuav ua li cas rub tib lub sijhawm ua haujlwm los ntawm cov ntawv excel hloov chaw thiab phiaj nws. Qhov haujlwm no yog qee qhov yooj yim tshaj plaws thiab siv dav hauv matlab. Cov lus qhia no yog npaj rau cov ntawm koj uas tsis tau siv matlab ua ntej thiab tsuas yog xav ua qee yam haujlwm yooj yim nrog nws. Cov cai tau hais tseg hauv txhua daim duab suav nrog kev tawm tswv yim yog li koj tuaj yeem luam tawm thiab muab cov cai. Ua siab dawb coj tus lej no thiab hloov kho kom haum rau koj daim ntawv thov.
Kauj ruam 1: Pib Matlab
Thawj kauj ruam yog kom tau matlab thiab ua haujlwm kom peb tuaj yeem pib ua haujlwm nrog nws. Thaum koj xub pib matlab nws yuav tsum zoo li cov duab hauv qab no. Thawj kauj ruam yog muab cov npe rau matlab ua haujlwm los ntawm. Nov yog qhov program yuav rub tag nrho cov ntaub ntawv los ntawm thiab yog qhov uas koj yuav tsum khaws tag nrho koj cov haujlwm matlab. Kuv pom zoo kom ua daim nplaub tshev tshiab nyob qhov twg koj yuav nco nws, thiab npe nws qee yam uas koj yuav paub. Thaum koj tau tsim daim nplaub tshev tshiab, nyem rau "…" nyob rau sab xis saum toj ntawm lub vijtsam raws li tau hais tseg hauv daim duab thib ob. Qhov no yuav nthuav tawm lub thawv xaub raws li pom hauv daim duab thib peb. Nrhiav daim nplaub tshev tshiab uas koj tsim hauv koj lub computer thiab xaiv nws. Rau qhov piv txwv no cov ntaub ntawv hu ua "370" thiab nyob ntawm lub desktop.
Kauj ruam 2: Tsim M-File
Tam sim no yam peb yuav tsum tau ua yog tsim cov ntawv M tshiab. M cov ntaub ntawv ua haujlwm zoo ib yam li ntaus tus lej ncaj qha rau hauv matlab, tab sis koj tuaj yeem txuag thiab hloov kho cov cai, thiab rov ua dua. Thaum nkag mus rau tus lej ncaj qha rau hauv matlab koj ntaus txhua kab ntawm tus lej ib tus zuj zus. Hauv ib daim ntawv M koj sau koj tus lej tag nrho ces khiav nws ib zaug. Muab koj tus cursor rau ntawm "Tshiab" ces nyem rau ntawm "Blank M File" raws li qhia hauv daim duab thawj. Dab tsi qhib yuav tsum zoo li daim duab thib ob. Qhov no tau ua tiav los ntawm ob kab ntawm cov cai: kaw tag nrho txhua yam Raws li pom hauv daim duab thib peb, ua kom txhua yam raug tshem tawm thiab kaw.
Kauj Ruam 3: Tsim Lub Sijhawm Vector
Thawj qhov peb yuav ua yog tsim lub teeb duab ntawm kev ua haujlwm hauv matlab. Thawj kauj ruam yog tsim kom muaj kev ywj pheej sib txawv. Hauv qhov no peb yuav hu nws "t" rau lub sijhawm. Txoj hauv kev peb yuav siv los tsim qhov sib txawv no yog ua cov vector. Vector yog qhov pib ntawm cov lej. Piv txwv, 1, 2, 3, 4 yuav yog luv luv vector. Cov cai los tsim cov vector no yog: t = 0.1: 0.01: 10; Thawj tus lej, 0.1 hais txog qhov pib. Tus lej thib ob, 0.01 hais txog qib loj. Tus lej thib peb, 10, hais txog qhov kawg. Yog li cov duab no sib raug rau 0.1, 0.11, 0.12… txhua txoj hauv kev mus txog 10. Yog xav pom tias tsim cov vector ua haujlwm, nyem lub pob ntsuab ua haujlwm tseem ceeb hauv daim duab thib ob. Qhov no khiav txoj haujlwm. Txhawm rau pom peb cov vector mus rau lub ntsiab matlab qhov rai. Nyem rau lub desktop, tom qab ntawd nyem rau ntawm lub desktop teeb tsa, thiab tom qab ntawd nyem lub neej ntawd raws li tau hais tseg hauv daim duab thib peb. Tam sim no koj lub vijtsam yuav tsum zoo li daim duab thib plaub. Ntawm sab xis koj yuav pom peb qhov kev hloov pauv tshiab, t. Nyem ob npaug rau nws thiab zoo li hauv daim duab thib tsib koj yuav pom cov lej tsim.
Kauj Ruam 4: Khiav thiab Teeb Duab Ua Haujlwm
Tam sim no peb yuav teeb lub luag haujlwm tsim hauv matlab. Thawj kauj ruam yog los tsim txoj haujlwm. Nov yog qhov yooj yim raws li sau tawm qhov kev ua lej xav tau. Ib qho piv txwv tau pom hauv thawj daim duab. Txoj cai siv rau txoj haujlwm no yog: y = sin (t)+4*cos (5.*t).^2; Lub sijhawm ua ntej sib npaug hauv cosine, thiab ua ntej lub xwmfab ntawm cosine qhia matlab ua cov haujlwm ntawd yooj yim ntawm qhov muaj nuj nqis ntawm lub sijhawm vector, tsis yog los kho lub sij hawm vector raws li cov lej thiab sim ua cov lej ua haujlwm ntawm nws. Cov kauj ruam tom ntej yog los tsim cov duab nws tus kheej. Qhov no yog ua tiav siv cov cai pom hauv daim duab thib ob. Kev txiav txim ntawm qhov hloov pauv hauv kab lus hais kom ua yog ib qho tseem ceeb heev yog li nco ntsoov teeb tsa koj cov cai ib yam li nws tau teeb tsa hauv qab no. xlabel ('Sijhawm (s)') ylabel ('Y Value') Title ('Y Value vs Time') grid onFinally, tsuas yog nyem lub xub xub xub ntsuab dua thiab daim duab yuav tsum zoo li hauv daim duab thib peb.
Kauj ruam 5: Rub cov ntaub ntawv los ntawm Excel
Tam sim no peb yuav tsim cov duab tib yam li ua ntej, tab sis los ntawm kev xa cov ntaub ntawv ua haujlwm los ntawm daim ntawv nthuav qhia zoo. Thawj daim duab yog lub screenshot ntawm daim ntawv nthuav qhia zoo uas yuav siv. Nws yog qhov tseeb cov ntaub ntawv cov ntsiab lus tsim hauv matlab hauv cov kauj ruam dhau los, tsuas yog ua hauv excel. To pib peb tuaj yeem tshem tawm cov cai tsim peb lub sijhawm vector thiab cov lej rau peb ua haujlwm los ntawm cov kauj ruam dhau los. Tam sim no koj tus lej yuav tsum zoo li daim duab thib ob. Nov yog tus lej nyeem cov ntawv excel. "A" hais txog cov lej uas yuav suav nrog txhua tus lej hauv daim ntawv teev npe, thiab "B" suav nrog tag nrho cov ntawv los ntawm daim ntawv teev npe. Cov t thiab y qhov sib txawv raug rub los ntawm thawj thiab ntu thib ob raws li qhia hauv txoj cai. [A, B] = xlsread ('excelexample.xlsx'); t = A (:, 1); y = A (:, 2); Daim duab tus lej kuj tseem tuaj yeem hloov kho raws li qhia hauv qab lub npov liab ntawm daim duab thib peb. Qhov no yuav rub cov npe kab ntawv thiab cov ntawv cim los ntawm daim ntawv nthuav tawm thiab muab tso rau ntawm koj daim duab.xlabel (B (2)) ylabel (B (3)) Title (B (1)) Qhov kawg uas yuav tsum ua yog khiav qhov program dua thiab koj yuav pom tib daim duab zoo li pom hauv daim duab kawg.
Kauj Ruam 6: Tsim Specgram
Hauv qib no peb yuav siv matlab los tsim cov specgram los ntawm kev nyeem cov ntaub ntawv suab wav. Qee qhov specgram qee zaum hu ua "2.5D graph," vim tias nws siv ob kab duab, nrog rau ntxiv cov xim los qhia qhov dav. Cov xim muab cov ncauj lus kom ntxaws dua li daim duab 2D yooj yim, tab sis tsis yog qhov nthuav dav ntawm daim duab 3D, yog li lo lus "2.5D." Kev ua haujlwm tshwj xeeb ntawm matlab siv cov txheej txheem cov ntsiab lus los ntawm cov ntaub ntawv wav thiab ua Fourier Transform ntawm cov ntsiab lus los txiav txim siab cov zaus nyob hauv lub teeb liab. Txog qhov kev qhia no, nws tsis yog ib qho tseem ceeb kom paub tias Fourier Transform ua haujlwm li cas, tsuas yog paub tias cov specgram yuav npaj qhov xwm txheej uas muaj tam sim no, thiab lawv muaj zog npaum li cas nrog rau lub sijhawm. Kev ua haujlwm npaj sijhawm rau ntawm X-axis thiab zaus ntawm Y axis. Lub zog ntawm txhua zaus tau tshwm los ntawm xim Hauv qhov no cov ntaub ntawv wav yog lub suab kaw ntawm ib daim hlau raug ntaus, thiab tom qab ntawd qhov kev co ntawm cov hlau raug kaw ua suab. Siv cov specgram, peb tuaj yeem txiav txim siab qhov yooj yim zaus ntawm cov hlau, vim tias qhov ntawd yuav yog qhov zaus uas nyob ntev tshaj plaws nrog lub sijhawm. Txhawm rau ua txoj haujlwm no, thawj zaug muaj matlab nyeem cov ntawv wav los ntawm kev siv cov cai hauv qab no: [x, fs] = wavread ('flex4.wav'); Hauv qhov no, flex4.wav yog lub npe ntawm peb cov ntaub ntawv wav, qhov sib txawv x yog cov ntsiab lus cov ntsiab lus hauv cov ntawv, thiab fs hais txog qhov piv txwv piv txwv., tsuas yog ntaus tus lej hauv qab no: specgram [x (:. 1), 256, fs]; 256 sib raug rau qhov zaus uas FFT tau ua thaum ntsuas cov ntaub ntawv. Matlab yog qhov pib txiav cov suab ntawv ua ntu thiab ua FFT ntawm txhua ntu Cov 256 qhia nws loj npaum li cas txhua ntu yuav tsum yog. Cov ntsiab lus ntawm qhov no tsis tseem ceeb, thiab 256 yog tus nqi nyab xeeb rau siv rau feem ntau daim ntawv thov. Los ntawm qhov no nws yog qhov yooj yim kom pom tias qhov sib npaug sib npaug sib npaug rau lub ncov liab nyob hauv qab txoj cai kaum sab xis ntawm daim duab. Qhov no yog lub ncov uas ua rau ntev tshaj plaws nrog kev hwm lub sijhawm.
Pom zoo:
VBScript Basics - Pib Koj Cov Ntawv, Ncua Sijhawm thiab Ntau Ntxiv!: 5 Kauj Ruam
VBScript Basics - Pib Koj Cov Ntawv, Ncua Sijhawm thiab Ntau Ntxiv!: Zoo siab txais tos rau kuv thawj qhov kev qhia yuav ua li cas thiaj ua tau VBScripts nrog notepad. With.vbs cov ntaub ntawv, koj tuaj yeem tsim qee qhov lom zem pranks lossis kab mob tuag taus. Hauv qhov kev qhia no, Kuv yuav qhia koj cov lus txib yooj yim xws li pib koj tsab ntawv, qhib cov ntaub ntawv thiab ntau ntxiv. Hauv t
Tsis Txaus Ntshai Racer Arduino OLED Game, AdafruitGFX thiab Bitmaps Basics: 6 Kauj Ruam
Racer Racer Arduino OLED Game, AdafruitGFX thiab Bitmaps Basics: Hauv qhov kev qhia no peb yuav saib yuav siv bitmaps li cas siv Adafruit_GFX.c lub tsev qiv ntawv raws li cov sprites hauv kev ua si. Qhov kev ua si yooj yim tshaj plaws uas peb tuaj yeem xav txog yog ib sab kab kab hloov pauv kev ua si tsheb, thaum kawg peb cov beta tester thiab tus pab coder de
Interfacing Pushbutton - Arduino Basics: 3 Kauj Ruam
Interfacing Pushbutton - Arduino Basics: Lub laub khawm yog ib feem uas txuas ob lub ntsiab lus hauv Circuit thaum koj nias nws.Thaum lub pob qhib qhib (tsis muaj kev nyuaj siab) tsis muaj kev sib txuas ntawm ob txhais ceg ntawm lub khawm, yog li tus pin txuas nrog 5 volts (los ntawm kev rub tawm resi
Animatronics Basics - Servo Motor: 8 Kauj Ruam
Animatronics Basics - Servo Motor: Txawm hais tias nws yog kev lom zem hnub so tso rau ntawm lub qhov rais ntawm lub khw muag khoom, lossis txaus ntshai Xus prank, tsis muaj ib yam dab tsi nyiam mloog zoo li tus menyuam roj hmab. Cov duab hluav taws xob no tau tswj qee zaum hu ua thiab thi
MPU6050-Accelerometer+Gyroscope Sensor Basics: 3 Kauj Ruam
MPU6050-Accelerometer+Gyroscope Sensor Basics: MPU6050 yog qhov muaj txiaj ntsig zoo tshaj plaws.Mpu 6050 yog IMU: Chav ntsuas inertial (IMU) yog lub tshuab hluav taws xob uas ntsuas thiab tshaj tawm lub cev tshwj xeeb quab yuam, tus nqi kaum, thiab qee zaum kev qhia ntawm lub cev, siv kev sib xyaw