Clear Filters
Clear Filters

how to call m-file in block simulink model???

1 view (last 30 days)
i have written the m-file to solve numerically a system of 4 partial differential equations which represent the infrared food dryer, and i have gotten result from that. the m-file that i wrote for this system has 4 function, one is for initial conditions of the equations, one is for the boundary conditions of the equations , one function is for main factors of the equations and last function gather all these functions and sole the equations. now , i want to connect a controller to this dryer in order to control the temperature of the emitter, so i need to put the m-file solution of the PDEs in the block simulink in order to connect with the controller block. i used s-function and matlab function to do that, but i got errors and i couldn't get result from that.

Accepted Answer

David Sanchez
David Sanchez on 10 May 2013
I think you are doing something wrong. I've been using m-files in Simulink to avoid the extra work of block-building what I have in a m-file, and some times it gets tricky, but if done with care, it should work. Since you do not give more info on how you are doing what you are doing, I can not help you out more. Check that your functions are in the proper directory and rightly linked.
  1 Comment
Muhmmed
Muhmmed on 10 May 2013
Mr.David thank u very much for ur help actually i have 4 functions that show good results the functions are
function pdex2 clc clear m1=0;
ux0=8.52;
uy0=0.5;
utg0=313.575;
uts0=303.575; . . .
function [pl,ql,pr,qr] = pdex2bc(xl,ul,xr,ur,t)
a=0.5; b=8.52; c=313.15; d=303.15;
pl = [ul(1); ul(2); ul(3)-c; ul(4)-d]; ql = [a; 0; c; d]; . . .
function u0 = pdex2ic(x) u0 = [1; 1; 1; 1; 1];
function [c,f,s] = pdex2pde(x,t,u,DuDx) c = [1; 1; 1; 1]; f = [(k1*k4*u(5))* DuDx; (k1*k2*u(5)-k3*u(2))* DuDx; -(k6*u(3))* DuDx; (-k7/(1+u(1))*k1*k8*u(5))]; . . .
so i just simply paste all these functions in matlab block function but i got many errors !

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!