New answers tagged

0

Second try Manipulate[ Module[{x, yNum, yDen}, {x, yNum, yDen} = {"x-Axis", "y-Axis num", "y-Axis den"} /. data; Pane["<your stuff here>"[x, yNum, yDen], {400, 100}] ], (* selector for axis categories *) {{axis, "x-Axis", "select"}, {"x-Axis", "y-Axis num", "y-Axis den"}, SetterBar[ Dynamic[axis, (axis = #; axiselement = Lookup[data, ...


1

This works for me: Clear[intfcurl]; intfcurl[x_?NumericQ, y_?NumericQ, z_?NumericQ] := With[{q = intfd[x, y, z]}, {q[[2, 3]] - q[[3, 2]], q[[3, 1]] - q[[1, 3]], q[[1, 2]] - q[[2, 1]]}] VectorPlot3D[intf[x, y, z] intfcurl[x, y, z], {x, -3, 3}, {y, -3, 3}, {z, 0, 1}] (But it helps not to have testdata based on a function with zero curl!)


1

You can generate data with proper replacement and use ListVectorPlot3D. vector = Table[intf[x, y, z] /. {x_, y_, z_} :> {x, 5 y, z}, {x, -3, 3}, {y, -3, 3}, {z, 0, 1}]; ListVectorPlot3D[vector] Or to do it in your way intf1[x_, y_, z_] := Module[{q = intf[x, y, z]}, {q[[1]], 5 q[[2]], q[[3]]}] VectorPlot3D[intf1[x, y, z], {x, -3, 3}...


1

I'm worried that your problem is intractable because of the large number of rows in your parameter file. Processing a few rows would be no problem, where few is defined as a thousand or so. Also if you were to accumulate lists of all the target values optcost, optbud, and optq, what would you do with such long lists? Each would have 1.5M elements according ...


7

To formalize the comments, here is the complete code: data = {1, 2, 3, 4, 5, 6, 7, 8, 9}; weight = {5, 4, 5, 2, 4, 2, 1, 1, 1}; Last[HistogramList[WeightedData[data, weight], 9]] Which outputs {5, 4, 5, 2, 4, 2, 1, 1, 1}


0

There is another solution, different from the one posted by @Szabolcs. It deals with string replacing and then converting to expression: readMatlabComplex[file_] :=ToExpression[ StringSplit[ StringReplace[ ReadList[file, "String"] , {"e" -> "*10^", "i" -> "*I"}] , ","]] It is about 10 times faster.


2

SemanticImport will handle it. Specify the column types explicitly. Example with one column: SemanticImportString[ "-5.07248931892817e-05+2.50260543778902e-18i -5.0723848172051e-05+2.870855441657444e-17i", {"ComplexNumber"} ] This returns a Dataset which you can convert to a list using Normal. Update: I can import your file without problems in ...


3

Usually we'll tend to fit linear system, and in this situaiton, add Log to data's y-axis will help: Log[a E^(b x)]=Log[a]+b x Truely, after this transformation, the points lay on a line~ great for fitting! It seems that this method could really do the work, so naturally, here comes the following code for fitting using normal linear fitting method: ldata ...


0

FindFit seems to work f[a_, b_, x_] = a*Exp[b*x]; expmodel[x_] = f[a, b, x] /. FindFit[data,f[a, b, x],{a, b},x] 50.3816 E^(-167.73 x) I will compare it with f1[x_]=E^(-0.08885264746563443` - 717.0097150284254` x) which can be found from Wjx's method. Show[{ListPlot[data, PlotRange->All], Plot[{expmodel[x],f1[x]}, {x, -0.01, 0.01}]}] Show[{...


5

You can use WeightedData[] for the purpose: FindDistributionParameters[WeightedData @@ Transpose[{{1, 11}, {2, 6}, {3, 1}, {24, 1}}], PowerDistribution[a, b], ParameterEstimator -> "MaximumLikelihood"] {a -> 0.041666666666666664, b -> 0.3657540721946402}


1

Szabolcs Horvát has a great bit of code that makes bring in tabular data via copy and paste super easy: Pasting tabular data from the web http://szhorvat.net/pelican/pasting-tabular-data-from-the-web.html


0

I cut and paste the numbers you have to a .csv file, importing them and was left with the numbers in Text format. Try this. ToExpression[Flatten[StringSplit[Flatten[Import["C:\\File.csv"]]]]] It flattens and converts it to a expression, numbers instead of text format.


4

Make some sample data consisting of numbers and spaces: samepleData = Module[{seed = ToString@Table[RandomInteger[{0, 10000}], 50]}, StringReplace[seed, {"{" -> " ", "}" -> " ", "," -> RandomChoice[{" ", " ", " "}]}]] (* 7476 8829 1505 3337 7282 7244 ...


2

Number counting approach Since your file contains (with rare exceptions) only 3 numbers on each line and the data has dimensions {400,4001,2}, it is possible to calculate how many lines you should read in order to obtain the first 40 sets out of 400. At first, some checks: data = << "EigF-V1_1.0-V2_0.000.txt"; Dimensions[data] {400, 4001, 2} ...


2

You have to use ErrorListPlots First configure the data properly. data = {{0.50, 0.23161000 10^-08, 0.22145199 10^-08}, {1.50, 0.45506399 10^-09, 0.26812801 10^-08}, {2.50, 0.12028299 10^-08, 0.25072699 10^-08}, {3.50, 0.12711100 10^-08, 0.25351401 10^-08}}; erdata = data /. {x_, y_, z_} -> {{x, y}, ErrorBar[z/10]}; Division by ...


-1

Sincerely David, it's not so difficult to look at the documentation Plot[{Sin[x], Cos[x]}, {x, 0, 2 \[Pi]}, PlotStyle -> {Dashing[.1], Dashing[0.01]}] Hope it will do the task


6

data = Table[ PDF[BinomialDistribution[50, p], k], {p, {0.3, 0.5, 0.8}}]; DiscretePlot[ Evaluate@data, {k, 1, 50}, PlotStyle -> { Directive[Black, Opacity[.5], AbsoluteDashing[{5, 5}]], Directive[Black, Opacity[.5], AbsoluteDashing[{10, 10}]], Directive[Black, Opacity[.5], AbsoluteDashing[{0, 0}]]}, PlotMarkers -> {Automatic,...



Top 50 recent answers are included