Question

MATLAB WORK PLEASEAn oscillating current in an electric circuit is given by: I = 9e-t sin(2nt) where I is the current in Amperes and t is the t

0 0
Add a comment Improve this question Transcribed image text
Answer #1

X 1 Editor - F:\Program Files\MATLAB\R2018a\bin\ current_fn.m current_fn.m X + function [ti, t2] = current_fn (I) 2 - F = @(x

Editor - F:\Program Files\MATLAB\R2018\bin\current_fn.m current_fn.mx function [ti, t2] = current_fn (I) F = @(x) 9.*exp(-x).

Call the function by typing in the command window >> [t1,t2] = current_fn(-1.15)

MATLAB CODE-

function [t1,t2] = current_fn(I)
F = @(x) 9.*exp(-x).*sin(2.*pi.*x); %current function
interval = [0,1.5]; %0 to 0.7 interval
N=500;
start_pts = linspace(interval(1),interval(2),N);

for i=1:numel(start_pts)-1
  
try
  
t(i) = fzero((@(x)F(x)-I),[start_pts(i),start_pts(i+1)]); %fzero function

end
end
nonzeroIndices = t~=0; %extract non-zero elements from matrix 't'
output = t(nonzeroIndices); %new matrix with extracted non-zeo elements
t1=output(1);
t2=output(2);
  

end

  

Add a comment
Know the answer?
Add Answer to:
MATLAB WORK PLEASE An oscillating current in an electric circuit is given by: I = 9e-t...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT