??? Error using ==> mldivide Matrix dimensions must agree.
1 view (last 30 days)
Show older comments
Hi everyone, I am trying to divide f0 but it keeps coming up with errors. I tried putting the dot before / as seen below but it is still not working. Am i missing something really simple? Thanks
c = 341; % speed of sound in air
%%% GF as function of Frequency PARAMETERS %%%
f01 = 50:50:500;
x2 = lx; %% far
y2 = ly;
z2 = lz;
% 1 fixed frequency <<
%%Calculated Parameters%%
w= 2 *pi *f01 ; %%angular frequency
lambda = c./f01 ;%%wavelength
k. = (2*pi)./lambda
1 Comment
abhijit kulkarni
on 17 May 2014
1) You have not defined varaible lx,ly lz.
put some value (ex. numeric value )
2) remove dot from k.
c = 341; % speed of sound in air
%%% GF as function of Frequency PARAMETERS %%%
f01 = 50:50:500;
% x2 = lx; %% far % % y2 = ly; % % z2 = lz; x2 = 1; %% far
y2 = 2;
z2 = 2; % 1 fixed frequency <<
%%Calculated Parameters%%
w= 2 *pi *f01 ; %%angular frequency
lambda = c./f01 ;%%wavelength
k = (2*pi)./lambda
you should get answer
Accepted Answer
Star Strider
on 17 May 2014
The dot (vectorising) is a good idea, unless you’re doing true matrix or vector operations. Then it leads to strange results.
These lines:
c = 341;
f01 = 50:50:500;
lambda = c./f01
k = (2*pi)./lambda <+++ this line works when you remove the dot after the k
produce decent-looking vectors for lambda and k. I only see f01, not f0, so I assume we’re looking at the correct section of code.
But then f0 (that does not appear) could be a boson or some other elemental quantity that refuses to be divided further.
0 Comments
More Answers (0)
See Also
Categories
Find more on Resizing and Reshaping Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!