Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Solve taking too long.

Subject: Solve taking too long.

From: Stas Berlyand

Date: 18 Feb, 2009 01:50:19

Message: 1 of 1

I am trying to solve what ends up being a 50 degree equation of one variable but solve command is taking forever. Code is below.
Is there any way I can do this faster? Is there a newton's method function or bijection function in matlab?
Thanks

L=10;
t=[-20:.01:20];
t2=[-20,1,20];
p=.2;
fone=(1/(sqrt(2*pi)))*exp((-1/2)*(t.^2));
ftwo=(1/(2*sqrt(2*pi)))*exp((-1/8)*(t.^2));
fjoint=p*(fone-ftwo)+ftwo;
integrand=((fone-ftwo).^2)./(fjoint);
f1=randn(1,L);
f2=2*randn(1,L);
f3=((f1-f2).^2);
f4=(p*(f1-f2)+f2);
dist=f3./f4;
plot(t,fjoint);
syms a;
area=trapz(t,fjoint);
f1=(1/(sqrt(2*pi)))*exp((-1/2)*(dist.^2));
f2=(1/(2*sqrt(2*pi)))*exp((-1/8)*(dist.^2));
fjoint2=((f2-f1)./(a*(f2-f1)+f2));
S=sum(fjoint2);
solve(S,.2)

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us