calculate equation by giving values
Show older comments
rl=3.56;
L=600e-6;
C=277e-6;
D=5/18;
R=3.56;
v0=400;
w=(3-4*D)/(C*R*(1-2*D))
Gdi=(v0*(3-4*D));
Hello, I need to calculate some values in matlab. However by giving it values it executes the answer for first formula, but not the second one. Also there are other equations need to be calculated which includes square root. Anyone can help?
2 Comments
Walter Roberson
on 3 Jul 2021
? Your code seems to calculate w and Gdi? I do not see any error or problems.
Khumara Nasibli
on 3 Jul 2021
Answers (1)
Image Analyst
on 3 Jul 2021
Not sure what you mean. Both w and Gdi have values as you can see in the workspace panel, or by taking the semicolon off the Gdi line.
w =
4309.82030584513
Gdi =
755.555555555556
What is the second formula and what variable is it supposed to calculate that it doesn't? You can put workspace in the code if you want to make sure that panel is showing:
workspace; % Make sure the workspace panel is showing.
rl = 3.56;
L = 600e-6;
C = 277e-6;
D = 5/18;
R = 3.56;
v0 = 400;
w = (3-4*D) / (C * R * (1 - 2 * D))
Gdi = (v0 * (3 - 4 * D))
A useful link for you to go through: Debugging in MATLAB | Doug's MATLAB Video Tutorials
And what is your third formula with the square root in it?
4 Comments
Khumara Nasibli
on 3 Jul 2021
Image Analyst
on 3 Jul 2021
There were tons of errors in your formulas, mostly because of missing * and capitalization errors and missing parentheses. Please double check the formulas, especially the order of operation and parentheses. But the code
rl = 3.56;
L = 600e-6;
C = 277e-6;
D = 5/18;
R = 3.56;
v0 = 400;
w = (3-4*D) / (C * R * (1 - 2 * D))
Q=sqrt(R*L*C *(rl+3*R * (1-2*D) *(1-D))/L+R*C*rl)
w0=sqrt((rl+3*R*(1-2*D)*(1-D)))
Gdi=(v0*(3-4*D))/(rl*(1-2*D)+3*R*(1-2*D)^2 *(1-D))
runs and spews this out to the command window:
w =
4309.82030584513
Q =
0.101988920240641
w0 =
2.64351057273243
Gdi =
243.269026923892
but again, check the formula VERY carefully for proper parentheses. It might be better to break it up into smaller terms then combine them:
term1 = 3-4*D
term2 = C * R * (1 - 2 * D)
w0 = term1 / term2
especially for the much more compilcated Q and Gdi formulas.
Khumara Nasibli
on 3 Jul 2021
Image Analyst
on 3 Jul 2021
I can see you're a man of very few words.
Different than what? Did you try to transcribe that equation out of a paper or book?
Did you look over the parentheses locations extreeeeeeeeeeeeeemely carefully.
Did you break it down into simpler terms like I recommended?
Do you still want help or not? It sounds like not.
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!