淘宝官方店     推荐课程     在线工具     联系方式     关于我们  
 
 

微波射频仿真设计   Ansoft Designer 中文培训教程   |   HFSS视频培训教程套装

 

Agilent ADS 视频培训教程   |   CST微波工作室视频教程   |   AWR Microwave Office

          首页 >> Ansoft Designer >> Ansoft Designer在线帮助文档


Ansoft Designer / Ansys Designer 在线帮助文档:


Nexxim Simulator >
Nexsys Discrete Time Domain Analysis >
   Nexsys MATLAB User Defined Models >
       Example MATLAB Model Files >
           Walsh Modulator Model               


Walsh Modulator Model

This example is a Walsh modulator model, walshmd.m. This I/O type model has one input and one output. The model definition line is:

% NEXSYS Functional_Model ("walshmd", "1","r", "N", "1","r", "2^N", "NO_DATA_REQ", "NOT_APPLICABLE", "N" )

Here are explanations for the entries:


“walshmd”

Model name (and function name)

“1”

One input

“r”

Input type is real

“N”

N samples needed per invocation

“1”

One output

“r”

Output is real

“2^N”

2^N samples generated per invocation

“NO_DATA_REQ”

No extra data reference is required

“NOT_APPLICABLE”

No probe domain

"N"

Parameter for the model


Here is the walshmd function declaration:

function [ y, SV ] = walshmd ( x, p, SV, status_in)

The input and output variables for the function are:


x

Input signal

p

Parameter values of the model

SV

State variable (in)

status_in

Input status

y

Output signal

SV

State variable (out)


Access input and output time step through global variables.:

% Declare the global variables this model need to access from Nexsys engine

global TS_OUT TS_IN

Get parameters:

% Get parameters from function argument p

N = p(1)

Generate the Walsh Matrix once initially and save it into the SV state_variables, then retrieve it on later passes.

nrows = 2^N

ncols = 2^N

num_mod_symbols = 1

outnsamp = num_mod_symbols*ncols

% (status_in == 0) => Analysis initialization stage

if status_in == 0

size = 1

mask = 1

WM(1,1) = 0

for i = 1:N

for m = 1:size

for n = 1:size

WM(m,n+size) = WM(m,n)

WM(m+size,n) = WM(m,n)

if rem(WM(m,n),2) == 1

WM(m+size,n+size) = 0

else

WM(m+size,n+size) = 1

end

end

end

size = size*2

end

SV = WM

else

WM = SV

end

Set output time step:

TS_OUT(1) = TS_IN(1)*N/ncols

Calculate output values and return:

cnt = 1

for j = 1:num_mod_symbols

factor = 1

mod_index = 1

for i = 1:N

mod_index = mod_index + factor * x(i+N*(j-1))

factor = 2*factor

end

for i = 1:ncols

y(cnt,1) = WM(i,mod_index)

cnt = cnt + 1

end

end

return




HFSS视频教学培训教程 ADS2011视频培训教程 CST微波工作室教程 Ansoft Designer 教程

                HFSS视频教程                                      ADS视频教程                               CST视频教程                           Ansoft Designer 中文教程


 

      Copyright © 2006 - 2013   微波EDA网, All Rights Reserved    业务联系:mweda@163.com