# Connexions

You are here: Home » Content » Simulation

### Recently Viewed

This feature requires Javascript to be enabled.

# Simulation

Module by: Ayana Andalcio. E-mail the author

## Code to produce v1

This code takes the input of the Y1 matrix and the initial impedance to produce a vector of v1 values, using equations discovered in previous research. This code also produces v2 as well as yin which is not needed for our purposes.

%function to produce values for v1 given a Y1 and S0
function v1 = nfc(Y1,S0)
n  = 41;
Z0 = 50;
A = S0;
S = zeros(n,n);

for k = 1:n,
for l = 1:n,
S(k,l)=A(k,2*l-1)*cos(A(k,2*l)*pi/180)+i*A(k,2*l-1)*sin(A(k,2*l)*pi/180);
end
end

Zparam = Z0*inv(eye(n)-S)*(eye(n)+S); % Zparameters of n-port system
Yparam = inv(Zparam);
W = Yparam; % Ys matrix

m = 20; % Number of receivers
r = n-1; % Maximum n-1

W11 = W(1:m,1:m);
W12 = W(1:m,(m+1):r);
W13 = W(1:m,r+1);
W21 = W((m+1):r,1:m);
W22 = W((m+1):r,(m+1):r);
W23 = W((m+1):r,r+1);
W31 = W(r+1,1:m);
W32 = W(r+1,(m+1):r);
W33 = W(r+1,r+1);

Yc = inv(W22 - W21*inv(W11)*W12 + Y1); % Complex Y matrix
Y = real(Yc); % Matrix M in paper
YY = imag(Yc); % Matrix N in paper
P = W22-W21*inv(W11)*W12; %*****W11+Y1 changed to W11

P1 = W31*inv(W11)*W12-W32; %*****W11+Y1 changed to W11

M = real(P);
M = 0.5*(M+M');

v2 = P1*(Y+YY*i); % Voltages as input to Y1
v1 = -v2*W21*inv(W11)-W31*inv(W11); % Voltages not connected to Y1 %*****W11+Y1 changed to W11

yin = v1*W13+v2*W23+W33;
return

Using this code, we could feed the function a variety of Y1 values to try and determine a pattern between the Y1 and the v1. This way, we were able to modify Y1 in whichever fashion we liked to see if there were visible patterns that could be seen within the v1 values. The code that calls this function then uses the value of v1 and Y1 to plot graphs and look at specific values.

## Content actions

PDF | EPUB (?)

### What is an EPUB file?

EPUB is an electronic book format that can be read on a variety of mobile devices.

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need an account to use 'My Favorites'.

| A lens I own (?)

#### Definition of a lens

##### Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

##### What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

##### Who can create a lens?

Any individual member, a community, or a respected organization.

##### What are tags?

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks