The following Matlab program(adsbygoogle = window.adsbygoogle || []).push({});

clc

clear all

for ef=1:100

ky=linspace(-ef,ef,ef*2);

for n=1:3

r(n,:)=2*ky;

end

end

encounters this error:

??? Subscripted assignment dimension mismatch.

Error in ==> testarrays at 6

r(n,:)=2*ky;

But if I useky=linspace(-ef,ef);there is no error! why?

In other words, what should I do to control the number of ky-points in each loop?

**Physics Forums | Science Articles, Homework Help, Discussion**

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

# Linspace problem in Matlab

Loading...

Similar Threads for Linspace problem Matlab |
---|

MATLAB MATLAB: forces acting on an object |

MATLAB Matlab histogram |

MATLAB Sovling Bernoulli's differential equation in matlab? |

MATLAB Does anyone had this plotting problem with MATLAB? |

Mathematica Solve Perturbation problem with mathematica |

**Physics Forums | Science Articles, Homework Help, Discussion**