You are Here: Home >< Maths

# Does anyone on here know how to use Matlab well. watch

1. So was bored so installed matlab.

I have a questions if anyone is proficient in matlab.

Thanks :P
2. I wouldn't say I'm proficient but I do know it to a certain extent, so I can help with some things
3. (Original post by Eternalflames)
I wouldn't say I'm proficient but I do know it to a certain extent, so I can help with some things
Thanks, just playing around with it.
Spoiler:
Show
Find the Matlab code of Newton Raphson method for f(x)=x^2-747

% Find the root of f(x)=x^2-747 using Newton Raphson method
% initial value: x=27, f(x(i))should be less than 1e-7
% Solution:
% f(x)=x^2-747=0
% f'(x)=2*x
% x(i+1)=x(i)-(f(x(i))/f'(x(i)))
clear; %clear the previous variables
clc; %clear the command window
format('long','g') %format of the numeric values: each number represented by about 15 digits
i=1;
x(i)=27;
f(i)=(-18);
fd(i)=54;
iter=0;
while abs(f(i))>1e-07 %termination condition
iter=iter+1;
x(i+1)=(x(i)-(f(i))/(fd(i)));
f(i+1)=((x(i+1))^2-747);
fd(i+1)=(2*x(i+1));
i=i+1;
end
disp(' root function value ' );% root and error
disp([x',f']);
disp ('total iterations needed');disp(iter); %displays number of iterations
Am I missing anything, thanks if you read this :P
4. (Original post by Mihael_Keehl)
Thanks, just playing around with it.
Spoiler:
Show
Find the Matlab code of Newton Raphson method for f(x)=x^2-747

% Find the root of f(x)=x^2-747 using Newton Raphson method
% initial value: x=27, f(x(i))should be less than 1e-7
% Solution:
% f(x)=x^2-747=0
% f'(x)=2*x
% x(i+1)=x(i)-(f(x(i))/f'(x(i)))
clear; %clear the previous variables
clc; %clear the command window
format('long','g' %format of the numeric values: each number represented by about 15 digits
i=1;
x(i)=27;
f(i)=(-18);
fd(i)=54;
iter=0;
while abs(f(i))>1e-07 %termination condition
iter=iter+1;
x(i+1)=(x(i)-(f(i))/(fd(i)));
f(i+1)=((x(i+1))^2-747);
fd(i+1)=(2*x(i+1));
i=i+1;
end
disp(' root function value ' );% root and error
disp([x',f']);
disp ('total iterations needed';disp(iter); %displays number of iterations
Am I missing anything, thanks if you read this :P
That all looks good to me, I put it into my Matlab and there were no errors, that would flag up if anything was missing, so I'd say all is good and have fun!
5. (Original post by Eternalflames)
That all looks good to me, I put it into my Matlab and there were no errors, that would flag up if anything was missing, so I'd say all is good and have fun!
thanks so much for the time and effort
6. (Original post by Mihael_Keehl)
thanks so much for the time and effort
No problem! Feel free to discuss any more questions here, I'll be more than happy to have a go at them

TSR Support Team

We have a brilliant team of more than 60 Support Team members looking after discussions on The Student Room, helping to make it a fun, safe and useful place to hang out.

This forum is supported by:
Updated: February 17, 2016
Today on TSR

### Tuition fees under review

Would you pay less for a humanities degree?

### Can I get A*s if I start studying now?

Discussions on TSR

• Latest
Poll
Useful resources

### Maths Forum posting guidelines

Not sure where to post? Read the updated guidelines here

### How to use LaTex

Writing equations the easy way

### Study habits of A* students

Top tips from students who have already aced their exams

## Groups associated with this forum:

View associated groups
Discussions on TSR

• Latest

The Student Room, Get Revising and Marked by Teachers are trading names of The Student Room Group Ltd.

Register Number: 04666380 (England and Wales), VAT No. 806 8067 22 Registered Office: International House, Queens Road, Brighton, BN1 3XE