Need help in Mathlab SImulink

habibctg

habibctg

@habibctg-Z8rZpC • Oct 21, 2024

Hi All,
I have designed a code generator in matlab, I need to build a simulink model of that code generator. Can anyone help me in this. I can send the mathlab code if needed.

Thank you

Replies

Welcome, guest

Join CrazyEngineers to reply, ask questions, and participate in conversations.

CrazyEngineers powered by Jatra Community Platform

  • Kaustubh Katdare

    Kaustubh Katdare

    @thebigk Jul 14, 2009

    Post your matlab code and enclose it with

     [ /code] tags.
  • habibctg

    habibctg

    @habibctg-Z8rZpC Jul 14, 2009

    stage=4;
    n = stage-2;
    N_z = 2^n-1;
    C0 = [1 1];
    S0 = [1 -1];
    C1 = conj(fliplr(S0));
    S1 = -conj(fliplr(C0));
    Mat_C = [C0 S0; C1 S1];
    for iter=1:n-1
    iter
    Length = 2^(iter+1);
    M_tmp=[];
    for loop=1:4:Length-3
    loop
    M_tmp(loop ,😀 = [Mat_C((loop-1)/2+1,1:Length/2) Mat_C((loop-1)/2+2,1:Length/2) Mat_C((loop-1)/2+1,Length/2+1:Length) Mat_C((loop-1)/2+2,Length/2+1:Length)];
    M_tmp(loop+1,😀 = [Mat_C((loop-1)/2+1,1:Length/2) -Mat_C((loop-1)/2+2,1:Length/2) Mat_C((loop-1)/2+1,Length/2+1:Length) -Mat_C((loop-1)/2+2,Length/2+1:Length)];
    M_tmp(loop+2,😀 = [Mat_C((loop-1)/2+2,1:Length/2) Mat_C((loop-1)/2+1,1:Length/2) Mat_C((loop-1)/2+2,Length/2+1:Length) Mat_C((loop-1)/2+1,Length/2+1:Length)];
    M_tmp(loop+3,😀 = [Mat_C((loop-1)/2+2,1:Length/2) -Mat_C((loop-1)/2+1,1:Length/2) Mat_C((loop-1)/2+2,Length/2+1:Length) -Mat_C((loop-1)/2+1,Length/2+1:Length)];
    end

    Mat_C = M_tmp

    end

    G = Mat_C;
    N_zero = zeros(1,N_z) ;
    L2 = length(G(1,😀);
    codeset(1,😀 = [N_zero(1:N_z) G(1,1:L2/2) N_zero(1:N_z) G(1,L2/2+1:L2)];
    codeset(2,😀 = [N_zero(1:N_z) G(2,1:L2/2) N_zero(1:N_z) G(2,L2/2+1:L2)];











    this is the matlab code. tq

  • habibctg

    habibctg

    @habibctg-Z8rZpC Jul 14, 2009

    stage=4;
    n = stage-2;                          
    N_z = 2^n-1;                                  
    C0 = [1 1];                                                  
    S0 = [1 -1];                                                
    C1 = conj(fliplr(S0));                      
    S1 = -conj(fliplr(C0));                     
    Mat_C = [C0 S0; C1 S1];                                   
    for iter=1:n-1             
        iter
        Length = 2^(iter+1);
        M_tmp=[];    
        for loop=1:4:Length-3
            loop
            M_tmp(loop  ,:) = [Mat_C((loop-1)/2+1,1:Length/2) Mat_C((loop-1)/2+2,1:Length/2) Mat_C((loop-1)/2+1,Length/2+1:Length) Mat_C((loop-1)/2+2,Length/2+1:Length)];
            M_tmp(loop+1,:) = [Mat_C((loop-1)/2+1,1:Length/2) -Mat_C((loop-1)/2+2,1:Length/2) Mat_C((loop-1)/2+1,Length/2+1:Length) -Mat_C((loop-1)/2+2,Length/2+1:Length)];
            M_tmp(loop+2,:) = [Mat_C((loop-1)/2+2,1:Length/2) Mat_C((loop-1)/2+1,1:Length/2) Mat_C((loop-1)/2+2,Length/2+1:Length) Mat_C((loop-1)/2+1,Length/2+1:Length)];
            M_tmp(loop+3,:) = [Mat_C((loop-1)/2+2,1:Length/2) -Mat_C((loop-1)/2+1,1:Length/2) Mat_C((loop-1)/2+2,Length/2+1:Length) -Mat_C((loop-1)/2+1,Length/2+1:Length)];
        end
        
        Mat_C = M_tmp
    
    end
    
    G = Mat_C; 
    N_zero = zeros(1,N_z) ;
    L2 = length(G(1,:));
    codeset(1,:) = [N_zero(1:N_z) G(1,1:L2/2) N_zero(1:N_z) G(1,L2/2+1:L2)];     
    codeset(2,:) = [N_zero(1:N_z) G(2,1:L2/2) N_zero(1:N_z) G(2,L2/2+1:L2)];