<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.2" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>k-Wave User Forum &#187; Topic: kspaceFirstOrder2D . Matrix dimensions must agree</title>
		<link>http://www.k-wave.org/forum/topic/kspacefirstorder2d-matrix-dimensions-must-agree</link>
		<description>Support for the k-Wave MATLAB toolbox</description>
		<language>en-US</language>
		<pubDate>Wed, 13 May 2026 08:16:34 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.2</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://www.k-wave.org/forum/search.php</link>
		</textInput>
		<atom:link href="http://www.k-wave.org/forum/rss/topic/kspacefirstorder2d-matrix-dimensions-must-agree" rel="self" type="application/rss+xml" />

		<item>
			<title>Bradley Treeby on "kspaceFirstOrder2D . Matrix dimensions must agree"</title>
			<link>http://www.k-wave.org/forum/topic/kspacefirstorder2d-matrix-dimensions-must-agree#post-7569</link>
			<pubDate>Sat, 06 Jun 2020 18:23:01 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">7569@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi jf,&#60;/p&#62;
&#60;p&#62;Thanks for the report. We'll make an effort to migrate the name of &#60;code&#62;smooth&#60;/code&#62; to something that doesn't conflict with the curve fitting toolbox.&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>alhareth on "kspaceFirstOrder2D . Matrix dimensions must agree"</title>
			<link>http://www.k-wave.org/forum/topic/kspacefirstorder2d-matrix-dimensions-must-agree#post-7535</link>
			<pubDate>Mon, 01 Jun 2020 09:46:34 +0000</pubDate>
			<dc:creator>alhareth</dc:creator>
			<guid isPermaLink="false">7535@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Dear jf&#60;/p&#62;
&#60;p&#62;I am facing the same problem. How to set the path of the toolbox and solve the problem?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>jf on "kspaceFirstOrder2D . Matrix dimensions must agree"</title>
			<link>http://www.k-wave.org/forum/topic/kspacefirstorder2d-matrix-dimensions-must-agree#post-7487</link>
			<pubDate>Wed, 06 May 2020 13:43:31 +0000</pubDate>
			<dc:creator>jf</dc:creator>
			<guid isPermaLink="false">7487@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;As far I can tell there is also another reason for this error appearance: While setting the path of the toolbox, i moved it to the bottom of the list. This prevented the toolbox integrated 'smooth' function to overload the matlab version, I think this is the reason that this error did not occur more often. Since I do not know how this interacts with other scripts I stick with renaming the smooth function and keep the toolbox at the bottom of the path-list.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>jf on "kspaceFirstOrder2D . Matrix dimensions must agree"</title>
			<link>http://www.k-wave.org/forum/topic/kspacefirstorder2d-matrix-dimensions-must-agree#post-7486</link>
			<pubDate>Wed, 06 May 2020 12:51:11 +0000</pubDate>
			<dc:creator>jf</dc:creator>
			<guid isPermaLink="false">7486@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;I guess I found the reason for this error, in 'kspaceFirstOrder_inputChecking' line 1540:&#60;/p&#62;
&#60;p&#62;source.p0 = smooth(source.p0, true);&#60;/p&#62;
&#60;p&#62;outputs a vector even though the input is a matrix. I replaced this line with &#60;/p&#62;
&#60;p&#62;source.p0 = smoothdata(source.p0, true);&#60;/p&#62;
&#60;p&#62;which returns a matrix, and it seems to be working (at least the output seems similar to the one in the documentation for this example).&#60;/p&#62;
&#60;p&#62;EDIT: I just realized that k-wave has its own smoothing function implemented, but as far I can tell, matlab is prioritizing using its own version. I just renamed the smoothing function in the toolbox folder from 'smooth' to 'smooth_k' and changed the line to&#60;/p&#62;
&#60;p&#62;source.p0 = smooth_k(source.p0, true);&#60;/p&#62;
&#60;p&#62;which also seems to work I guess as intended.&#60;/p&#62;
&#60;p&#62;EDIT2: Since 'smooth_k' recalls itself recursively line 62&#60;/p&#62;
&#60;p&#62;mat_sm = smooth(varargin{2:end});&#60;/p&#62;
&#60;p&#62;has to be changed to the renamed function aswell:&#60;/p&#62;
&#60;p&#62;mat_sm = smooth_k(varargin{2:end});
&#60;/p&#62;</description>
		</item>
		<item>
			<title>jf on "kspaceFirstOrder2D . Matrix dimensions must agree"</title>
			<link>http://www.k-wave.org/forum/topic/kspacefirstorder2d-matrix-dimensions-must-agree#post-7485</link>
			<pubDate>Wed, 06 May 2020 12:15:39 +0000</pubDate>
			<dc:creator>jf</dc:creator>
			<guid isPermaLink="false">7485@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi,&#60;br /&#62;
I just installed the k-wave toolbox and tried to run the examples, but I always get the same error (Matlab 2018b):&#60;/p&#62;
&#60;p&#62;Matrix dimensions must agree.&#60;/p&#62;
&#60;p&#62;Error in kspaceFirstOrder2D (line 920)&#60;br /&#62;
        ux_sgx = dt .* rho0_sgx_inv .* real(ifft2( bsxfun(@times, ddx_k_shift_pos,&#60;br /&#62;
        kappa .* fft2(p)) )) / 2;&#60;/p&#62;
&#60;p&#62;Error in example_3_ivp_opposing_corners_sensor_mask (line 82)&#60;br /&#62;
sensor_data = kspaceFirstOrder2D(kgrid, medium, source, sensor);&#60;/p&#62;
&#60;p&#62;The reason for the error is that in the function 'bsxfun(@times, ddx_k_shift_pos, kappa .* fft2(p))' the variable 'kappa' is of size NxN (128x128 in example_ivp_homogeneous_medium), while 'fft2(p)' is of the size (N^2)x1 (16384).
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
