matlab.txt

来自「本课设完成的是任意信号卷积的运算,并且绘制图象.」· 文本 代码 · 共 86 行

TXT
86
字号
function y=juanji(f1,f2)
syms x t;
F1=laplace(f1,x,t);
F2=laplace(f2,x,t);
h3=F1*F2;
h4=simplify(h3);
y=ilaplace(h4,t,x);

function plotbutton1_Callback(hObject, eventdata, handles)

val=get(handles.listbox1,'value');
str=get(handles.listbox1,'string');
vala=get(handles.a,'string');

c=str2num(vala);
valb=get(handles.b,'string');

d=str2num(valb);

switch str{val}
val1=get(handles.f1,'string');
x=sym(val1);
axes(handles.axes1);
 ezplot(x);val2=get(handles.f2,'string');
x=sym(val2);
axes(handles.axes2);
ezplot(x);

     case 'f1(t)*f1(t)'
      
 val3=get(handles.f1,'string');
 f1=sym(val3);

           y=juanji(f1,f1);
           axes(handles.axes3);
           ezplot(y); 
    case 'f2(t)*f2(t)'
         val4=get(handles.f2,'string');
         f2=sym(val4);
         y=juanji(f2,f2);
         axes(handles.axes4);
         ezplot(y);

    case 'f1(at)*f2(bt)'

        if(c==1&&d==1)
          val5=get(handles.f1,'string');
          f1=sym(val5);
          val6=get(handles.f2,'string');
          f2=sym(val6);
          y=juanji(f1,f2); 
          axes(handles.axes5);
          ezplot(y);

        elseif(c~=1||d~=1)
           c=num2str(c);  
           d=num2str(d);
           val7=get(handles.f1,'string');

           f1=sym(val7); 
           val8=get(handles.f2,'string');

           f2=sym(val8);
           y=addm(f1,f2,c,d);
           axes(handles.axes6);
           ezplot(y);

 

        end
end

function y=addm(f1,f2,c,d)
syms x t;

   F1=laplace(f1,x,t/c);
   F1=F1/abs(c);
   y1=simplify(F1);
   F2=laplace(f2,x,t/d);
   F2=F2/abs(d);
   y2=simplify(F2);
   h3=y1*y2;
   y=ilaplace(h3,t,x);
   y=simplify(y);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?