Need help writing this function
信息
此问题已关闭。 请重新打开它进行编辑或回答。
显示 更早的评论
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 个评论
John Chilleri
2017-2-8
Do you have the equations for voltage magnitude and phase angle that the professor wants you to use (in terms of G, C, w, and z)?
John Chilleri
2017-2-8
Other than my previous comment, you need multiplication signs between your values and a:
z = [0.1a a 10a...
should be
z = [0.1*a a 10*a...
and I'm not sure what to make of your last few lines just yet, but given the equations, I can probably provide some useful hints.
Justin Goh
2017-2-8
John Chilleri
2017-2-8
Do you know what the z is useful for?
Justin Goh
2017-2-9
John Chilleri
2017-2-9
That sounds reasonable, assuming (G+jwC) is invertible. But make sure you write
x = A\w
not
x = A/w
回答(0 个)
此问题已关闭。
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!