Want to create a 3d graph of chi^2 for a 2d data set /w 3 parameters

11 ビュー (過去 30 日間)
Jake
Jake 2012 年 6 月 26 日
Hi, Ive recently been modifying a short simulated annealing algorithm that fits decay curves. I'm currently trying to minimize a weighted r sqrd function and I would like to see what a surface mesh graph of the solution space is. I have 2 parameters (Ae^kt) and two data sets (Time, signal (1001 data points) and I keep on running into a 'matrix has to been same size to use .*' The code im trying to use is:
[X,Y] = meshgrid(80:1:120, -.1:.005:0); Z = (1/1001)*sum((X.*exp(Y.*Time)-signal).^2)./sqrt(signal); surf(X,Y,Z)
Where X,Y are A,k. Z should be single valued, how can i formulate this so matlab treats A,k as free variables and plots Z in the 3rd dimension?

回答 (1 件)

Stephen
Stephen 2012 年 6 月 26 日
it looks like X and Y are not a single value, but the result of meshgrid, and when you perform the .* operations with the 1001 element vectors you see and error because the dimensions mismatch. Try using 1 time and signal point, or make a meshgrid with signal and time and use 1 A,k pair.

カテゴリ

Help Center および File ExchangeProbability Distributions and Hypothesis Tests についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by