Borrar filtros
Borrar filtros

Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Unusual size of array

1 visualización (últimos 30 días)
Prabhanshu Chandra
Prabhanshu Chandra el 13 de Ag. de 2020
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
close all;
clc;
clear;
sobj=sparameters('W=2um_L=20um.s2p');
s=sobj.Parameters;
freq=sobj.Frequencies;
y_params = s2y(s);
y11=y_params(1,1,:);
y12=y_params(1,2,:);
y21=y_params(2,1,:);
y22=y_params(2,2,:);
Ca=(imag(y11+y12))./(2*pi.*freq);
Cb=(imag(y22+y21))./(2*pi.*freq);
R=real(-1/y21);
L=(imag(-1/y21))./(4*pi*freq);
In the code above I converted S parameter in s2p file attached to y parameters, and I am trying to to calculate some values from that. However for some reason the size of Ca, Cb and L arrays is unusual, according to me they should be 1D arrays with 201 values, however when calculated they come out to be 201X201 values.
Can someone point out the mistake in my code? I am very new to this, any optimisation and use of objects and how I am accesing y parameters, any improvement will be highly appreciated.
Thankyou in advance.
  2 comentarios
David Hill
David Hill el 13 de Ag. de 2020
You just need to examine the sizes of your arrays in your workspace. I suspect that freq matrix is a 201x201. Not sure how you want to handle it.
R=real(-1./y21);%I believe you need ./
L=(imag(-1./y21))./(4*pi*freq);%same here
Prabhanshu Chandra
Prabhanshu Chandra el 14 de Ag. de 2020
This is the workspace, as you can see freq is 1D array.
About the ./ , I did that earlier, it did not have any change in the results.

Respuestas (1)

Bruno Luong
Bruno Luong el 17 de Ag. de 2020
Try this
sobj=sparameters('W=2um_L=20um.s2p');
s=sobj.Parameters;
freq=sobj.Frequencies;
y_params = s2y(s);
y11=y_params(1,1,:);
y12=y_params(1,2,:);
y21=y_params(2,1,:);
y22=y_params(2,2,:);
Ca=(imag(y11(:)+y12(:)))./(2*pi.*freq(:));
Cb=(imag(y22(:)+y21(:)))./(2*pi.*freq(:));
R=real(-1./y21(:));
L=(imag(-1./y21(:)))./(4*pi*freq(:));

La pregunta está cerrada.

Productos


Versión

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by