Langsung ke konten utama

The MATLAB Function Block

In addition to reading and creating MATLAB variables, Simulink can utilize MATLAB functions. Simulink blocks perform a specific operation on inputs and return outputs. This is analogous to a function in text-based code. The MATLAB Function block (Simulink > User-Defined functions) allows you to incorporate a MATLAB function directly into your model.




Double-clicking on the MATLAB Function block opens a MATLAB Editor:


The input, 
u
, and the output, 
y
, of the function are mapped to the input and output, respectively, of the block. Adding additional inputs or outputs will change the number of ports on the block:

The MATLAB Function block is useful when incorporating existing MATLAB code and when modeling complicated algorithms.


Task 1
In this lesson, you will model the power output from a tidal turbine over the course of several hours. The equation for this is

Power=12CpρA(2g|ΔH|)3/2
.
The Sine Wave block in the model represents the height differential, 
ΔH
, of the water on different sides of the turbine.

TASK
The MATLAB Function block has been pre-populated with the values of the constants. Double click on the block to open the MATLAB editor, and then add the equation such that 
ΔH
 is the input, and turbine power is the output.



Komentar

Postingan populer dari blog ini

Pengukuran Laju Aliran Fluida (Oil dan Gas)

     Dalam bidang minyak dan gas, teknologi untuk mengukur aliran berfungsi untuk mengukur jumlah produksi yang dihasilkan dalam setiap waktunya. Bernama "flow meter" sebuah alat yang digunakan untuk mengukur aliran,  pressure, temperature dari aliran minyak atau gas tersebut.  Flow meter juga dapat berfungsi sebagai alat monitoring yang akan menjadikan pekerjaan lebih mudah dengan tingkat keamanan yang baik saat terjadi overpressure atau kondisi yang abnormal. Beberapa aspek yang diukur dari kinerja suatu aliran adalah accuracy, repeatability, linearity dan resolution. Dengan aspek kinerja tersebut, flow meter pun dibagi menjadi 3 jenis : Differential pressure, Positive Displacement, dan Coriolis Mass Flow Meter. Dan akan dibahas secara terpisah dan lebih jelas pada uraian dibawah ini. Differential Pressure (DP) Flow Meter https://alvindocs.com/public/vendor/webarq/admin-lte/plugins/elfinder/files/News/NewFolder/pengukuran%20laju%20aliran%20fluida.gif Alat ini ...

Automotive Simulink Performance Package

     Dalam proyek ini, Kita akan mensimulasikan logika untuk paket kinerja otomotif. Kendaraan saat ini memiliki lusinan komputer yang bersama-sama menyesuaikan perilaku mobil sebagai respons terhadap data yang dibaca oleh ratusan sensor. Dalam sistem yang disederhanakan ini, asumsikan Anda merespons dua sensor kecepatan dan akselerasi lateral untuk memutuskan antara mode "kinerja tinggi" dan "ekonomis". Untuk mensimulasikan data sensor, model menggunakan blok yang belum Anda lihat: blok Editor Sinyal. Namun, jangan khawatir, Editor Sinyal hanyalah jenis sumber lain, seperti Gelombang Sine atau Ramp. Kita dapat memeriksa sinyal ini dengan menggunakan apa yang telah dipelajari sebelumnya, dan menambahkan Cakupan ke model. Task 1 Blok Editor Sinyal menyediakan sumber data simulasi. Port pertama blok menghasilkan kecepatan, dan port kedua menghasilkan percepatan lateral. Kita harus terlebih dahulu memproses data input. Secara khusus, KIta perlu mengambil nilai absolut ...