(adsbygoogle = window.adsbygoogle || []).push({});

As for the exercise above here is my attempt:

Code (Text):function c=wregress(x,y,sy)

a=[x.^2]

b=[sy.^2]

A=[sum(a\b) sum(x\b); sum(x\b) sum(1\b)]

d=(x.*y)

B=[sum(d\b);sum(y\b)]

c=A\B

When I use the test code given above,

I get this plotting:

which doesnt seem right to me....or is it?

Im assuming thefitted lineis a line of best fit??

If there is any mistake on the code can you please help?

**Physics Forums - The Fusion of Science and Community**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Simple code writing?

Can you offer guidance or do you also need help?

Draft saved
Draft deleted

Loading...

Similar Threads - Simple code writing | Date |
---|---|

LaTeX \vec command | Jan 31, 2018 |

Simple MATLAB loop | Oct 30, 2015 |

Coding up a simple geometric algebra in MATLAB | Oct 12, 2015 |

Simple Matlab question code | Apr 22, 2010 |

MATLAB simple code | Feb 21, 2010 |

**Physics Forums - The Fusion of Science and Community**