comp.soft-sys.matlab - The MathWorks calculation and visualization package.
I am beginning a linear modeling project using SimPowerSystems and simulink. I am so new to this that while I can manage to construct a simple RC circuit and simulate it; I cannot seem to return a transfer function's magnitude and phase plots vs frequency. I would like to be able to programatically and iteratively change the elements' values and analyze the transfer function. I know there is a way to do this. Can anyone help me? Is there a good demo for this?
Hi all, Can anyone advise me on how to write a m-file to simulate a simple rc high pass filtering with sinewave.I want to see how well this rc high pass filter perform in matlab and also can this rc filter be build on electronic circuit. I tried a few way, but it doesnt seem to be working. Pls advise
function dcrl = RL (t,i) %function for RL circuit calculations clear all; Vs=50; R=1; L=9; t=1:1:100; i0=0; for x=1:30, i(x)=(Vs/R)*(1-exp(-(R/L)*t(x))); end for x=31:100, i(x)=i(30)*exp(-(R/L)*t(x)); end plot (t,i) I am using those coding above and I cannot get the right answer. There is a simple R (resistance), L (inductance) circuit with switch. The real formula for this equation to solve is di/dt=Vs/R-R*i/L. When we solve this equation it comes up i(t)=(Vs/R)*(1-exp(-(R/L)*t). Then I use matlab to plot i(t) and calculate potential of L and R and their current. On the other hand I use ode45 to solve it directly(you can see below) function dcrl = inductansoff(t,i) % function for RL circuit calculations Vs=50; i0=0; L=9; R=1; X = Vs/L; Y = i*R/L; if t<30 dcrl = X - Y; else dcrl = -Y; %switched 0ff Vs=0 if t>50 dcrl = X - Y; else dcrl = -Y; %switched 0ff Vs=0 end end but I could not plot exactly what I want to see. Does anyone can help me, maybe one word can be so valuable for me. Thanks Gurhan Ertasgin
I am new to matlab and simulink. I built an s-function lms2.m in my modle lms.mdl. The two inputs of the S-fun are exported from a look-up table block. when debuged,it appears"Output returned by S-function 'lms2' in block 'lms/S-Function' during flag=3 call must be a real vector of length 1" Then i set a breakpoint while "case 3" in the s-fun lms2.m. I found the inputs of the s-fun are both "NaN". It was said that the output of the look-up table bolck was NaN. But when tested singlely, the output of the look-up table block had no flaw. i want to know why. Thanks. Ps:My english is poor, i hope i have explained clearly.