Please Explain Octave-Error : operator /: nonconformant arguments (op1 is 1x1, op2 is 1x10)
Add a . before your *, /, and ^ signs. This will ensure that octave uses scalar multiplication instead of matrix multiplication.
n=Nc.*(e.^(-Eg./(2.*k.*T)));
Related videos on Youtube
![FoolingAround](https://i.stack.imgur.com/s6FkF.jpg?s=256&g=1)
Comments
-
FoolingAround about 4 years
I have an issue running a certain script in octave. This is the code that produces the error:
#germanium T=410:20:600; x=linspace(400,410,100); y=linspace(10^9,10^9,100); k=8.5*10 .^(-5); Eg=0.59; Nc300=1.02*10^13; Nc=Nc300*((T/300).^(3/2)); n=Nc*(e.^(-Eg/(2*k*T))); plot(T,n,x,y,'m'); grid on xlabel('Temprature'); ylabel('Electron Density n'); title('Germanium n(T)');
As mentioned in the Title, the error that is produced is the following: error: ger5: operator /: nonconformant arguments (op1 is 1x1, op2 is 1x10) I have done a lot of testing, and I figured that the problem originates from the T variable on the 9th line : n=Nc*(e.^(-Eg/(2*k*T))); The codes run fine without it. For example :
#germanium T=410:20:600; x=linspace(400,410,100); y=linspace(10^9,10^9,100); k=8.5*10 .^(-5); Eg=0.59; Nc300=1.02*10^13; Nc=Nc300*((T/300).^(3/2)); n=Nc*(e.^(-Eg/(2*k*500))); plot(T,n,x,y,'m'); grid on xlabel('Temprature'); ylabel('Electron Density n'); title('Germanium n(T)');
In which case I simply replaced T with 500 , the code runs perfectly fine. Sadly T, can not be replaced by a certain number since it is the variable used in my graph. Although I did some digging, I never managed to fully understand this error, or how to fix it, thus any help would be greatly appreciated. Thanks.
-
FoolingAround about 5 yearsOh, I swear I tried that already... Thanks a lot for the response, my issue is solved. :)
-
stack-delay about 4 years@ForeverTinkering Please let us know what the solution was so others that have the same problem can benefit from your experience.
-
Irfan Yaqub almost 4 years@Silver can you please answer this. idk what is wrong here. stackoverflow.com/questions/63666436/…