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

I'm trying to create a plot in Matlab but just keep getting errors. It works very well in Mathematica but I want to learn some Matlab. However with all the errors I get I will probably stay with Mathematica. Maybe someone here can help me out.

So, I'd like to create a plot of the formula 1/Sqrt(1-(v²/c²))

It is OK to just replace c by 1 and I'd like to have a plot with v starting at 0.1 and going up to 0.99

In Mathematica I type:

Plot[1/(Sqrt [1 - (v^2/1^2)]), {v, 0.1, 0.99}, PlotRange -> Full]

This gives the expected result.

In Matlab I can assign a fixed value like 0.98 to v and I'm able to calculate the result using:

v=0.98

1/sqrt(1-(v^2/1^2))

However I have no idea how to plot this with v starting at 0.1 and going to 0.99

I tried:

v=0.1:0.01:0.99;

x=1/sqrt(1-(v^2/1^2))

plot(x)

I just keep getting mpower errors. I have absolutely no idea what to do.

Can anybody help me out with this ?

Many thanks in advance.

Michael

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

Join Physics Forums Today!

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

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

# Matlab code help

Loading...

Similar Threads - Matlab code help | Date |
---|---|

Matlab MATLab: Not enough inputs for nlinfit | Nov 16, 2017 |

Matlab Help needed to fix a matlab code | Nov 8, 2017 |

[Matlab] Gui help for adding code | Jun 4, 2014 |

Help with MATLAB code; discrepancy between graph max and Matlab's max | Feb 15, 2014 |

Please I need a Help with matlab code (Controlling the LEGO NXT Using MatLab) | Dec 7, 2012 |

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