Info

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

Need help writing this function

1 visualización (últimos 30 días)
Justin Goh
Justin Goh el 8 de Feb. de 2017
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
Got to write this function for a homework assignment. The function is meant to take in input arguments G,C,w and z and produce the voltage magnitude and phase angle as the output. My professor gave us a general idea of what the function should look like but I am still having trouble figuring out how to write it. Below is what I have so far. Am I missing anything?
function [mag,phase]=bode1(G,C,z,w);
f = [0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 2 3 4 5 6 7 8 9 10 20 30 40 50 60 70 80 90 100 200 300 400 500 600 700 800 900 1000];
a = [1 2 3 4 5 6 7 8 9];
z = [0.1a a 10a 100a 1000a];
w0 = 2*pi*f
x = [v1; v2; v3; v4; v5; v6; v7; v8];
y = x*(w0)
mag = [];
phase = [];
mag[mag abs(x)];
phase[phase angle(x)];
v = mag(1,;) ;
end
  6 comentarios
Justin Goh
Justin Goh el 9 de Feb. de 2017
I believe z was meant to represent the frequency matrix. I forgot to mention that we were suppose to produce the output voltage at varying frequencies. Also a correction to my last comment. The formula is suppose to be (G+jw(c))x=w. With x being the vector that stores the voltage values. Could I do this: Let A=G + jwC, therefore to find the voltage vector,x : x = A/w ?
John Chilleri
John Chilleri el 9 de Feb. de 2017
That sounds reasonable, assuming (G+jwC) is invertible. But make sure you write
x = A\w
not
x = A/w

Respuestas (0)

La pregunta está cerrada.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by