Matlab
@UnkleRhaukus
?
**math lab
% defining input variables for RLC circuit f_volt = 60; % measured in hertz W_volt = 120; % measured in volts rms R = 100; % measured in ohms L_o = 0.005:0.005:0.245; % matrix L 2D matrix incr. from left to right C_o = 5e-6:10e-10:9.5e-5; % matrix C 2D matrix incr. from top to bottom % current output for RLC circuit (I) in RLC circuit (note: j = sqrt(-1)) I = 120. / ((100 + j*2*pi(f_volt).*L_o - (j / 2*pi*(f_volt).*C_o)) % total power ouput in RLC circuit %
My main concern is if the L_o and C_o are setup correctly?
so I guess my matrices don't agree in dimension so...
[x-new, y-new] = meshgrid(x,y) ?
ahhh okay. Why wouldn't we use meshgrid?
if you transpose cap the dimensions don't work
nvm i will figure it out, night!
it's not night time
yes it is.
were?
Did you mean: >> I = 120. / ((100 + j*2*pi(f_volt)*L_o - ((j) / (2*pi*(f_volt)*C_o)))) Error using pi Too many input arguments.
slacker
% defining input variables for RLC circuit f_volt = 60; % measured in hertz W_volt = 120; % measured in volts rms R = 100; % measured in ohms L_o = 0.005:0.005:0.245; % matrix L 2D matrix incr. from left to right C_o = 5e-6:10e-10:9.5e-5; % matrix C 2D matrix incr. from top to bottom [L_o, C_o] = meshgrid(L_o,C_o); % current output for RLC circuit (I) in RLC circuit (note: j = sqrt(-1)) I = 120 / ((100 + j*2.*pi(f_volt)*L_o - (j / 2.*pi*(f_volt)*C_o)) % power observed by resistor P_R = 100*abs(I.^2); @UnkleRhaukus
@reemii
So for some reason my current equation isn't running smoothly
Look at the assignment above...
there's a missing parenthesis in `120 / ((100 + j*2.*pi(f_volt)*L_o - (j / 2.*pi*(f_volt)*C_o))`
`I = 120 / ((100 + j*2.*pi(f_volt)*L_o - (j / 2.*pi*(f_volt)*C_o))` on that line
@reemii I don't know what the problem is...
my editor says that there the parenthesis starting just after `120 /` is not closed.
>> I = 120. / ((100 + j*2*pi*f_volt*L_o) - (j. / 2*pi*f_volt*C_o)) I = 120. / ((100 + j*2*pi*f_volt*L_o) - (j. / 2*pi*f_volt*C_o)) ↑ Error: Unexpected MATLAB operator.
I closed it and now it says the / is not valid operator
I = 120. / (100 + j*2.*pi*f_volt*L_o - (j. / (2.*pi*f_volt*C_o)))
do i have to put a . right after the numerator when I am dividing by a matrix?
I don't know. What is the matrix there? Also, I don't understand the meaning of the `j.` in the denominator . Why the dot?
L_o = 0.005:0.005:0.245; % matrix L 2D matrix incr. from left to right C_o = 5e-6:10e-10:9.5e-5; % matrix C 2D matrix incr. from top to bottom
j is an imaginary number instead of using i. Do I need to use i? Even if I use i the code shows a problem
>> lab03 Error using / Matrix dimensions must agree. Error in lab03 (line 18) I = (120)/(100 + 1i*2*pi*60*L_o - ((1i)/(2*pi*60*C_o)));
`I = 120 / ((100 + j*2.*pi(f_volt)*L_o - (j / 2.*pi*(f_volt)*C_o)) ` without `j.` `I = 120 / ((100 + j*2.*pi(f_volt)*L_o - (j. / 2.*pi*(f_volt)*C_o))` with `j.` Try the first one. Also, are you sure you want `2.*pi*(f_volt)*C_o)` and not `(2.*pi*(f_volt)*C_o))` ?
^as you can see above i made all of those corrections
`120. /` is not `120 ./` . You wrote `120. /`, did you try `120 ./` ?
okay well that worked.
so when I run the code I just get an array of calculations that go on forever how can i stop it ?
oh nvm it stopped
% power obsorbed by resistor P_R = 100*abs(I.^2); % stores max power inside P_R matrix max_PR = max(P_R); so how do I go about solving this part? Use your results to report which specific value for L and value for C resulted in max PR. Store these two results in the variables max L and max C, respectively. The find function should be instrumental here
% power obsorbed by resistor P_R = 100*abs(I.^2); % stores max power inside P_R matrix max_PR = max(P_R); Max_L = find(max(L_o)) ???
Join our real-time social learning platform and learn together with your friends!