//www.tatmou.com/matlabcentral/answers/questions?term=tag%3A%22matrix%22 MATLAB Answers -新问题匹配标签:“matrix” 2021-09-25T16:24:34Z 标签:www.tatmou.com, 2005:问题/ 1458894 2021-09-23T01:16:48Z 2021-09-25T16:24:34Z 平滑数据函数不适用于矩阵。有人知道这是怎么回事吗? 我附上了一个60x22矩阵a。我有一个单元格数组,包含一个像这样的矩阵。我试图使用smoothdata函数平滑每一列,但奇怪的是,它没有按预期(或根本没有)工作。例如,我可以运行:a_smooth=smoothdata(a)或a_smooth=smoothdata(a,1),这两个函数都应该平滑每个列,但矩阵中没有任何变化。如果我运行一个向量,它工作得很好。最后,我将对每个单元格中包含矩阵的数组使用以下内容:smooth_cell=cellfun(@smoothdata,a,'UniformOutput',false)任何细节都值得赞赏。谢谢 BobbyRoberts //www.tatmou.com/matlabcentral/profile/authors/15462922 标签:www.tatmou.com,2005:Question/1460564 2021 - 09 - 25 - t14:22:01z 2021-09-25T14:33:42Z 我如何比较一个矩阵的值? 大家好,这是我非常复杂的代码。与矩阵命名为meanbasket,这是一个矩阵21x7我必须检查当一个值在另一列中重复%这是为了在我的磁盘中找到正确的文件夹srcFile = dir('C:\用户\agnes\图片\POST处理4\PP4 TGC-MED RD 100\*.dcm');路径名= ('C:\用户\agnes\图片\POST处理4\PP4 TGC-MED RD 100\');% i'm defining the images numberofimages = 21;numberofroi = 7;我正在寻找一些ROI的参考图像,这将需要%创建矩阵I=dicomread('2');imshow(I) R = nan(numberofroi,4);面具=细胞(numberofroi, 1);For nr = 1: numofroi h = drawrectangle(gca);等待(h); R(nr,:)=h.Position; masks{nr}=h.createMask; end roibasket = cell(numberofroi,numberofimages); meanbasket = nan(size(roibasket)); for ni = 1:numberofimages for nr = 1:numberofroi filename=(num2str(ni)); pileofimages=dicomread(strcat(pathname,filename)); info=dicominfo(strcat(pathname,filename)); roibasket{nr,ni} = imcrop(pileofimages,R(nr,:)); meanbasket(nr,ni) = mean( pileofimages(masks{nr}) ); %meanbasket is my 7 * 21 matrix, where the values are the averages of the ROIs found earlier %FROM NOW I DON'T KNOW HOW TO CONFRONT THE VALUES OF MY MATRIX end end 中国阿格尼丝 //www.tatmou.com/matlabcentral/profile/authors/21899607 标签:www.tatmou.com,2005:Question/163483 2014 - 11 - 20 - t01:53:21z 2021-09-25T12:49:18Z 涉及矩阵的MATLAB问题 编写一个MATLAB函数,该函数包含一个矩阵、一个行号和一个列号。从传递给函数的行号开始,向下扫描传递给函数的列,并返回包含列中最大绝对值的行号。例如,如果您的矩阵是>并且您通过了第2行第2列,那么函数应该返回3。第3行在第2列(包括第2行和第2行以下)中具有最大的绝对值。 B蹭 //www.tatmou.com/matlabcentral/profile/authors/5915407 标签:www.tatmou.com, 2005:问题/ 261044 2015 - 12 - 19 - t21:41:45z 2021 - 09 - 25 - t08:21:31z 保存和加载一个矩阵 你好,我知道这是一个一般的问题,但我有麻烦与保存矩阵和加载到另一个代码。我做;保存(“vzpre1”、“款”);%变量是vz,我保存为vzpre1。我只是想只保存vz矩阵,没有其他内容我想将vzpre1加载为vz。但一旦我装上子弹。它加载为结构,而不是矩阵。任何想法?谢谢 Kamuran //www.tatmou.com/matlabcentral/profile/authors/1504443 标签:www.tatmou.com, 2005:问题/ 1459784 2021-09-24T04:55:55Z 2021-09-24T07:51:12Z 读单词和索引 如果我直接读取一个单词,如:word = 'CABDABCCDAA';[uniqueLetters, ~,印第安纳州]=独特(词);disp(印第安纳州)印第安纳州将如:3 1 2 4 1 2 3 3 1 1但我需要读取一个文件,这可能是一个长文件,但作为一个例子我得到第一个3行:12 CABDABCCDAA 87658大卫。所以我做了这个:乔纳森inlist = fopen(“用法”);linx = fgetl (inlist);While ischar(linx) x = strsplit(linx);这将为我获得单词,我们将它静态地放在上面的第一个例子disp(toWord);[uniqueLetters, ~,印第安纳州]=独特(词);%输出与toWord的输出相同;最终文件关闭(inlist);但是这里我没有得到,只有这个输出,我怎么能得到相同的输出,我认为我的错误是从矩阵中得到一个单元格,我做toWord=x(1,2); but I am not sure how to fix this. Nicle戴维森 //www.tatmou.com/matlabcentral/profile/authors/23541484 标签:www.tatmou.com, 2005:问题/ 1459159 2021 - 09 - 23 - t10:54:07z 2021 - 09 - 24 - t04:38:38z 摆弄矩阵,输入数值 我想要一个像X这样的矩阵我有一个单词ABCD这个单词有一个符号数字12矩阵X是由X=0(5,5)组成的我已经决定它会是这样的:开始一个B C D开始0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 D 0 0 0 0 0 0 0 0 0 0我会从开始到a,把数字12放在X中(开始,a)位置,然后我从A到B,把数字12放在X(A,B)的位置,等等,行是从,列是到,我怎么能把数字放在这些位置,我怎么能告诉矩阵,例如位置X(3,3)如果在给定的单词中,你遇到了类似BB的东西,或者在这个例子中我们遇到了ABCD,我怎么能告诉矩阵,当你遇到CD,然后在X(4,5)中放入一个值12?这里的矩阵X需要理解,如果我以a开始一个单词,那么它会在X(1,2)的位置放置一个数字12然后我来到AB,我从A到B,所以12的值应该放在X(2,3)中,依此类推,直到ABCD单词完成(这意味着对BC做一次,对CD做一次,并在这些位置保存矩阵X和12的新值。有点难以解释,但我希望它有意义 Nicle戴维森 //www.tatmou.com/matlabcentral/profile/authors/23541484 标签:www.tatmou.com, 2005:问题/ 1459604 2021 - 09 - 23 - t21:39:47z 2021 - 09 - 23 - t21:39:47z 帮助创建相平面肖像 我有一个函数定义:function [t,y]=second_order(a0,a1,tspan,y0) dydt=@(t,y)[y(2);-a0*y(1)-a1*y(2)];[t、y] =数值(dydt tspan, y0);plot(t,y(:,1)) xlabel('t'),ylabel('y(t)') title('数值积分')end %例如:clc clear close a0 = 10;a1 = 1;Tspan = [0 20];y0 = (2; 0);[t、y] = second_order (a0, a1, tspan, y0);我将改变a0和a1并绘制结果。然而,现在我试图创建相平面肖像。 I was given the following to work with: cla; % clears the current axis (plot) - a weird thing with this phase plane plotter PhasePlane(@(t,x)second_order(t,x,a0,a1),t,x0) % plots the phase plane axis square; hold off; % makes sure the axis are square (not stretched) % I am very new to matlab and have little to no idea how to create phase plane portraits to begin with. I was also given PhasePlane.m to keep in the same directory, along with ode45. How would I create a phase plane portriat using the above information and codes? % Here is the original question: Phase plane portraits are a useful visualization tool for evaluating the behavior of second order ODEs, or equivalently two dimensional linear systems, x˙(t) = Ax(t), (6) where A is a 2 × 2 matrix. As the video you watched described, a phase plane portrait creates a vector field by visually plotting arrows that represent the vector-value of the derivative x˙ corresponding to different locations x. The solutions of the system are formed by tracing a curve through the “flow” of these arrows. The original starting point of the curve is the initial condition of the system. I have borrowed some code to make a phase plane plotter for you. Make sure the file PhasePlane.m is downloaded from eLearning and located in the same directory as your other files. I’ve made it so this is called with the same format as ode45: 1 PhasePlane(@(t,x)second_order(t,x,a0,a1),t,x0) Uncomment the last lines of the stub code to plot the phase plane( seen above). For each of your plots from Section 4, generate a corresponding phase plane portrait with the same parameters and initial conditions. To generate nice plots, you may consider using the subplot command which works like this: 1 figure() 2 subplot(2,1,1) % creates a grid of plots with 2 rows and 1 column 3 % the last argument selects the first location as active 4 plot(t,y); 5 subplot(2,1,2) % selects the second location as active 6 PhasePlane(@(t,x)second_order(t,x,a0,a1),t,x0) Select three of your plots and discuss in detail how the solution plots of y(t) and the phase plane portraits exhibit the same features/behavior 萨尔埃文斯 //www.tatmou.com/matlabcentral/profile/authors/18358584 标签:www.tatmou.com,2005:Question/1459459 2021 - 09 - 23 - t18:04:47z 2021 - 09 - 23 - t21:36:58z 两个3*3矩阵乘法在matlab中用于for循环。 你好;我需要两个3*3矩阵([3,3]*[3,3])的乘法,使用for循环。谢谢。实际上我要用matlab做矩阵乘法代码。我们将两个矩阵作为用户的输入,并在matlab中执行矩阵乘法。这可以用于matlab中的数组乘法。 maede曼迪 //www.tatmou.com/matlabcentral/profile/authors/23455172 标签:www.tatmou.com, 2005:问题/ 1459244 2021 - 09 - 23 - t12:29:30z 2021 - 09 - 23 - t20:52:24z 通过单元格数组进行索引 我正在寻找填充单元格数组命名为'age_list'基于我在两列的值;对于每个特定的'day',我正在查看相应的'pop'值,然后基于它更新'age_list'。例如:第4天,人口是3。因此单元格数组'age_list'将具有'three'值,其值为{2,3,4}。有人能建议我怎么做吗?任何帮助都将不胜感激。 哈里克里希南 //www.tatmou.com/matlabcentral/profile/authors/13142902 标签:www.tatmou.com, 2005:问题/ 1459549 2021-09-23T19:57:04Z 2021 - 09 - 23 - t20:35:16z 如何从时间1到最后一次累计值 我有超过10000个文件,我想在这段时间内积累给定变量的值,然后在一张图像上绘图。我该怎么做呢?文件是1000x1000矩阵。 粉红色的花 //www.tatmou.com/matlabcentral/profile/authors/18011377 标签:www.tatmou.com, 2005:问题/ 1459194 2021 - 09 - 23 - t11:32:52z 2021 - 09 - 23 - t11:54:56z 将数字替换为文本 你好,我有以下问题。我有一个矩阵a它的维数是300x350。在这个矩阵中,我想用短语“NO”替换值5。我写了一个小代码,但它没有替代。我附上代码。%查找表A中数字5的位置[i1,k1]=find(A==5);% Replace value 5 with text "NO" for i=1:length(i1) for j=1:length(k1) if A==5 A(i1(i),k1(j))=disp('NO');例如:你的帮助是无价的。 stelios loizidis //www.tatmou.com/matlabcentral/profile/authors/14069691 标签:www.tatmou.com, 2005:问题/ 1459044 2021 - 09 - 23 - t07:51:41z 2021-09-23T10:14:53Z 从MATRIX中查找特定元素的位置返回'0×1空双列向量' 大家好,我有一个矩阵,我试图找到一些特定元素的位置,但它没有给我答案。我的代码:[i,j] = find(a==23.5975) %从图中可以清楚地看到,这个值出现在%第一行和第三列。但它给出了以下结果。i = 0×1空双列向量j = 0×1空双列向量我将感谢任何帮助,谢谢你。 周词 //www.tatmou.com/matlabcentral/profile/authors/22927747 标签:www.tatmou.com, 2005:问题/ 1458899 2021-09-23T01:35:11Z 2021 - 09 - 23 - t05:38:18z DD长纬度高程转换为XYZ和绘图 我被要求提取gpx文件数据到一个可用的格式使用低级别io。这个数据代表了一个定时下山的山地自行车跑。我已导入数据,并将长/纬度和高程提取为可用格式。现在我的任务要求我转换DD Long和Lat(和海拔?)成一个东北格式,然后将被绘制成一个三维空间。我得到了一个excel表格,其中扩展了坐标转换的公式。跟踪数据,excel文件和代码至今包括在内。我有两个问题:什么是最好的方向转换成东北格式的Long/Lat ?我有个主意。但不确定其真实性。也不确定如何以可用的方式提取和使用excel公式。 And secondly my extraction process interupted the time solutions. how can i reformate those excessive colums and extract them in a usuable fomat similar to the lat and long? Any guidence would be appreciated thankyou. %% Part 1 %Data import and extraction clear;clc;close all fid = fopen('Track-64.gpx'); i= 1; while ~feof(fid); temp = fscanf(fid,'%s',1); tf = strcmp(temp,'\n%*5s%f%*6s\n%*6s%f-%f-%fT%f:%f:%f%*8s\n']; data = fscanf(fid,format,9); rawdata(i,:)= data; i=i+1; end end fclose(fid) Lattitude = rawdata(:, 1); Longitude = rawdata(:, 3); Elevation = rawdata(:, 2); % time matrix? needs recombining first % Long/Lat now to be converted possible in the bellow example %% Part 2 %Coordinate conversion %for i = 1:length(importedData.trk.trkseg.trkpt) % lonDeg(i) = importedData.trk.trkseg.trkpt(i).lonAttribute; % about 20-30 lines of code doing calculations % end % easting(i) = % Final calculation step % northing(i) = % Final calculation step 布兰登摩尔 //www.tatmou.com/matlabcentral/profile/authors/23308438 标签:www.tatmou.com, 2005:问题/ 1458839 2021-09-22T21:54:33Z 2021 - 09 - 23 - t01:13:21z 向量和矩阵的行之间的互相关 嗨,我想交叉关联一个向量(x)与矩阵(26X5501)的每一行。有可能吗?我可以使用哪个函数。我试过xcorr,但它对我不起作用。谢谢 Paola Bardetti //www.tatmou.com/matlabcentral/profile/authors/14720905 标签:www.tatmou.com, 2005:问题/ 215252 2015 - 05 - 06 - t00:10:23z 2021 - 09 - 22 - t16:47:48z 矩阵演算的误差分析 嗨,我试图计算这样一个系统:< < / matlabcentral /答案/ uploaded_files / 30411 / CodeCogsEqn.png > >我已经知道解决方案:< < / matlabcentral /答案/ uploaded_files / 30412 / CodeCogsEqn (1) . png > >但是当我把这些东西放在Matlab,我得到以下错误:> > sym L C R s;> > C = [[R + s * L - s * L]; [s * L R + s * L + 1 / (s * C)]] C = [R + L * s, - L * s] [- L * s, R + L * s + 1 / (C * s)] > > V = [[R + s * L, 1]; [L - s * 0]] V = [R + L * s, 1] [0] - L *年代,> > i2 =侦破(V) /精细(C) ans = (C * L * s ^ 2) / (C C * R ^ 2 * s + 2 * * L * R * s ^ 2 + R + L * s) > > vo = i2 / (s * C)错误使用symengine(59)行操作数无效。sym = mupadmex(op,args{1}. Error in sym/privBinaryOp (line 903)年代,args{2}。年代,变长度输入宗量{:});/(第297行)X = privBinaryOp(A, B, 'symobj::mrdivide');为什么Matlab不能执行这样的计算?这不是我第一次做这种计算了。相反,如果我声明一个变量C1,一切顺利:> > sym C1 > > C = (((R + s * L), s * L]; [s * L, L (R + s * + 1 / (s * C1)))) C = [R + L * s, - L * s] [- L * s, R + L * s + 1 / (C1 * s)] > > V = [[R + s * L, 1]; [L - s * 0]] V = [R + L * s, 1] [0] - L *年代,> > i2 =侦破(V) /精细(C) / (s * C1) i2 = (L * s) / (C1 * R ^ 2 * s + 2 * C1 * L * R * s ^ 2 + R + L * s)名为* C *的变量有什么问题吗?谢谢你的帮助。 zmath //www.tatmou.com/matlabcentral/profile/authors/6326604 标签:www.tatmou.com, 2005:问题/ 347449 2017 - 07 - 05 - t10:12:14z 2021 - 09 - 22 - t15:44:08z 是否可以在单元格数组的每个单元格内旋转数据 我有一个单元格数组,每个单元格内都有一个矩阵。我需要旋转矩阵。我已经找到了rot90命令,它可以很好地用于单个矩阵oor,用于旋转单元阵列的单元。我的问题是,是否可以不单独旋转每个矩阵?我正在考虑使用cellfun来尝试做这个cellfun(rot90(finishCell{k},3));这似乎是在操纵单元格数组的单元格,而不是其中的数据 亚伦史密斯 //www.tatmou.com/matlabcentral/profile/authors/9670029 标签:www.tatmou.com, 2005:问题/ 1458399 2021 - 09 - 22 - t09:02:25z 2021 - 09 - 22 - t12:12:06z 用for循环生成一个设计矩阵 大家好,我正在尝试创建一个设计矩阵的模拟目的使用循环与向量,但我在与什么写在最内部的循环。数字是任意的,为了掌握它的窍门,我需要能够将它放大对于值大于或等于100的向量。代码如下:a = (1: 3)';B = (4: 6)';C = (7: 9)';For I = a For j = b For k = c e(I, j k)=…端端端结果应该与所有组合的可能性3向量矩阵和应该像:e = 1 4 7 1 4 8 1 4 9 1 5 7 1 5 1 5 1 9 6 7 8 1 6 8 1 6 9 2 4 7…希望你们能帮忙,谢谢! 安德斯·拉森 //www.tatmou.com/matlabcentral/profile/authors/10950068 标签:www.tatmou.com,2005:Question/1458429 2021-09-22T09:38:55Z 2021 - 09 - 22 - t11:30:04z 使用ode45确定特定节点的时间依赖强迫响应 函数[qdot] =导数(t,q,A,B) F(9,1) = 100* sin100 *t;%共有7个节点(每个节点4个自由度)。我想施加这两个力F(10,1) = 100*cos(100*t)qdot = A*q +B*F;% state space eqn - A - 56x56| q - 56x1 | B - 56x28| F - 28x1(除第9 /10行以外的所有零)%如何写这个依赖时间的力向量,我已经%写的方式是不正确的。在简单的%系统中,我们习惯于直接写% force eqn。但是在这个%集合的系统中,我不知道如何继续我写的方式%没有显示任何错误,但它是%不正确的,因为我得到了奇怪的%响应。所有矩阵A B都是预先定义的,并且是常数。力向量是时间的%函数(28x1),在第9行和第10行只有两个值。如何将其纳入状态空间eqn ? options = odeset; [time,q]=ode45(@deriv,Time0,zeros(2*ndof,1),options,A,B); time = time'; response = C*q'; return I am doing FEM formulation of a rotordynamics problem. Please help me regarding this. 舒巴姆 //www.tatmou.com/matlabcentral/profile/authors/19332031 标签:www.tatmou.com,2005:Question/1458029 2021 - 09 - 21 - t19:34:03z 2021-09-22T10:52:15Z 重复计算8个数字 你好,你能帮我吗?我是这个项目的新手,我想重复计算这些数字 卡迈勒alshehri //www.tatmou.com/matlabcentral/profile/authors/19374395 标签:www.tatmou.com, 2005:问题/ 1458354 2021-09-22T08:03:28Z 2021 - 09 - 22 - t09:29:25z 获取包含某些数据的行号 大家好,我想为我的问题找到一个解决方案:我有一个230x2矩阵,它包含不同的数字。我想让程序告诉我,哪一行包含大于400的数字。我该怎么做呢?我尝试了“查找”函数,但它没有给我带来一个有用的结果。谢谢你!毫克。 默特古尔 //www.tatmou.com/matlabcentral/profile/authors/15404885 标签:www.tatmou.com, 2005:问题/ 1456814 2021 - 09 - 20 - t09:37:48z 2021 - 09 - 22 - t08:42:32z 如何绘制图形? 我有一个50x6的矩阵,范围在0-1之间。现在我必须以这样一种方式绘图,X轴和Y轴的范围是0到1,图形应该有50条线(矩阵的行数据)。你能启发我策划这件事吗? 哈沙M V //www.tatmou.com/matlabcentral/profile/authors/8626163 标签:www.tatmou.com,2005:Question/1458304 2021 - 09 - 22 - t07:08:46z 2021 - 09 - 22 - t07:08:46z 关于将差分方程重新表述为矩阵方程的问题 差分方程和边值为:。我知道如何用特征向量求解y(n),得到齐次解和特解,并用边值解系数。然而,我不知道如何将整个差分方程重新表述为矩阵方程。有人能帮忙吗? 威廉 //www.tatmou.com/matlabcentral/profile/authors/20630272 标签:www.tatmou.com,2005:Question/1458119 2021 - 09 - 21 - t22:39:28z 2021 - 09 - 22 - t05:41:52z 如何在矩阵上加0 ? 我有一个矩阵,它是1x52500。如果不是,我想在末尾加0。这是我得到的,但它没有加0。矩阵= 0 (52500);if length(index) ~= length(Matrix 莎拉Nolt-Caraway //www.tatmou.com/matlabcentral/profile/authors/21805232 标签:www.tatmou.com,2005:Question/1458239 2021 - 09 - 22 - t05:10:47z 2021 - 09 - 22 - t05:18:31z 图像正在旋转,但是变白了! 我尝试在不使用imrotate的情况下旋转图像。逻辑很好,图像也在旋转。但是图像有噪音或其他东西,变得苍白。任何帮助我将感激,因为我是一个初学者在这方面。谢谢你!%读取输入图像img = imread('dog.jpeg');img_90 = rotate90 (img);img_180 = rotate90 (img_90);% display result subplot(1,3,1), imshow(img), title('Original Image');subplot(1,3,2), imshow(img_90), title('旋转(90)'); subplot(1, 3, 3), imshow(img_180), title('Rotated (180)'); function rotated = rotate90(img) [r, c, z] = size(img); % Create dummy matrix to store updated matrix. rotated(c, r, z) = 0; % Loop to access each element of matrix. for plane = 1:z for i = 1:r for j = 1:c % Logic to rotate Matrix A by 90 degree. rotated(c-(j-1), i, plane) = img(i, j, plane); end end end end 拉维Keshri //www.tatmou.com/matlabcentral/profile/authors/23802311 标签:www.tatmou.com,2005:Question/1458144 2021 - 09 - 22 - t00:28:59z 2021-09-22T02:31:04Z 将结果合并到单个矩阵中 代码:h = [1 2 3 4 5];因为我= 2:4 First_Matrix = [h(张)h (i) h (i + 1)结果:First_Matrix = 1 2 3 First_Matrix = 2 3 4 First_Matrix = 3 4 5我要帮助结合成一个单一的结果矩阵从h1 3 x5 h5,我想要的答案。First_Matrix = [1 2 3 0 0;0 2 3 4 0;我不想硬编码它。请帮助!如果有人能帮助我,我会非常感激。 Io7 //www.tatmou.com/matlabcentral/profile/authors/23941181 标签:www.tatmou.com, 2005:问题/ 1457769 2021-09-21T13:42:38Z 2021-09-21T19:20:25Z 我需要一个函数来确定一个数字是否是向量或矩阵的一部分。 我不需要知道数字或位置,我只需要知道一个数字是否属于一个向量或矩阵。我使用ismember函数,但它是非常慢,当我重复这许多次,我想要一个替代。唯一需要考虑的是它必须是一个函数或快速代码。 Clodoaldo de Souza Faria Júnior //www.tatmou.com/matlabcentral/profile/authors/17842373 标签:www.tatmou.com, 2005:问题/ 1457479 2021 - 09 - 21 - t07:24:16z 2021 - 09 - 21 - t16:11:15z 找出矩阵中跨行出现的重复次数 给定一个2xn维的矩阵,在行维数中有几个带有重复的数。这些值将它们的计数减到最多2。现在我想确保我只考虑行中的那些元素,如果它们的计数是1,对于任何数字,我都会跳过它们。我尝试做唯一的(A(1,))。在我的矩阵上,但它没有给我正确的结果我当前用于索引中重复查找结果的代码超过了错误函数ids=find_index(A,B)ids=[];对于i=1:size(A,2)对于j=1:size(B,2)if(A(1,i-1)=A(1,i))ctr=ctr+1;end%ctr=sum(A(1,:)==A(1,i));如果(B(1,j)==A(1,i)&ctr id==1)ids=[end,i];否则继续 思帕诗garg //www.tatmou.com/matlabcentral/profile/authors/2122425 标签:www.tatmou.com, 2005:问题/ 1457109 2021 - 09 - 20 - t17:16:31z 2021 - 09 - 21 - t12:39:05z 如何每10张图像对应1张图像? 假设我们有两个文件夹A和B,都包含图像。让文件夹A有6张图片:a1,a2,…,a6文件夹B有60张图片:b1,b2,…,b60。我想为A中的每个图像选择10张B中的图像,用下面的方法为a1选择b1,b2,…, a2选择b11,b12,…,b20…对于a6选择b51,b52,…,b60 努尔Bano //www.tatmou.com/matlabcentral/profile/authors/11967560 标签:www.tatmou.com, 2005:问题/ 1456839 2021 - 09 - 20 - t10:27:33z 2021 - 09 - 21 - t11:14:08z 如何在Matlab中求解矩阵方程 我试图求解以下一组矩阵方程,r1、r2、r3和的值是已知的。和的值可以通过在matlab中求解该方程来找到。我试图使用fsolve函数来实现这一点。但是,它无法得到一个解。有没有更好的方法来解这个问题?函数F=root2d(Ficksang)rfinal=(0-0-0.1010.101233861621621737-0.10-10.10-10.101233861621621621777年,0.10-0-0-0-0-0-0.0-0-0.10-0.10-0.101233861621621777-0.0-0-0.10-0-0-0-0-0-0-0-0-0-0-0.10-0-0-0-0-0-0-0-0-0-0-0-0-0.10-0-0-0.10-0-0-0-0-0-0-0.10.10-0.10-10.10.10-0.10-10-10.10-10-10.10-10-10.10.10-10.10-10-10-10-10.10-10-10.10.10-10.10-10-10-10.10.10-10-10.10-10_f/2)/。。。(1+(tan(theta_f/2)*tan(phi_f/2)*tan(psi_f/2));f(3)=r3-((tan(theta_f/2)-(tan(phi_f/2)*tan(psi_f/2))/…(1+(tan(theta_f/2)*tan tan psi_f/2));fun=@root2d;x0=[0,0];x=fsolve(fun,x0) 朱利安·布莱克松 //www.tatmou.com/matlabcentral/profile/authors/23697199 标签:www.tatmou.com, 2005:问题/ 1450164 2021-09-09T18:01:50Z 2021 - 09 - 21 - t10:42:05z 我想画出r和的特征向量,但我不知道怎么画? 信谊S rθsigma_rr = (S / 2) * (1 - (a / r) ^ 2) + (S / 2) * (1 - 4 * ((a / r) ^ 2) + 3 * (a / r) ^ 4) * cos(2 *θ)sigma_00 = (S / 2) * (1 + (/ 2) ^ 2) - (S / 2) * (1 + 3 * (a / 3) ^ 4) * cos(2 *θ)sigma_0r = - (S / 2) * (1 + (2 * (a / r) ^ 2) 3 * (a / r) ^ 4) *罪(2 *θ)= (sigma_rr sigma_0r;B= [cos(theta), sin(theta);-sin(theta), cos(theta)] C=转置(B) D = C*B*A e= eig(D) [V, e]= eig(D) 斯瓦特弗里索酒店 //www.tatmou.com/matlabcentral/profile/authors/19503247 标签:www.tatmou.com,2005:Question/1457609 2021 - 09 - 21 - t10:03:08z 2021-09-21T10:33:33Z 我有一个二维数组。我想看看。 我是新的MATLAB和我面临以下的麻烦-我有一个二维数组(称为轨迹)。它有7808行和2列。我想看看!命令:trajectory(:,:,1)或traj托利(:,:,2)没有帮助,因为我得到大约5000行,而不是完整的数组。我也可以保存为2个excel文件吗?请帮助!先谢谢你,伊沙尼 Ishani穆克吉 //www.tatmou.com/matlabcentral/profile/authors/16387294 标签:www.tatmou.com, 2005:问题/ 1453754 2021 - 09 - 15 - t13:35:58z 2021-09-21T08:47:04Z 如何合并两个表,保持自变量(x)不变,但对因变量(y)求和 你好,我试图合并和和两个数据集。我有来自两个不同地点的年和渔获数据,并希望将它们合并到一个数据集,其中年保持不变,但渔获量为相应的年份相加。 萨曼莎·法夸尔 //www.tatmou.com/matlabcentral/profile/authors/23603514 标签:www.tatmou.com, 2005:问题/ 1457414 2021 - 09 - 21 - t05:17:22z 2021-09-21T05:36:39Z 从矩阵C的第一行和第二行以及第二列、第三列和第四列创建一个名为mat_B的2x3矩阵。 我已经有了这个问题的答案,但我不确定它是否正确。因为我对这个问题有点困惑。作为参考,这是矩阵C:这是我目前的答案: 无名氏 //www.tatmou.com/matlabcentral/profile/authors/23970151 标签:www.tatmou.com, 2005:问题/ 1456474 2021 - 09 - 19 - t21:20:02z 2021 - 09 - 21 - t02:32:39z 在循环一个数组时创建多个数组 我想循环遍历一个包含81个元素的数组。对于通过循环的每9次迭代,我想创建一个分配给不同变量名的新数组。基本上,我想要的是循环遍历这个有81个元素的数组,用9次来创建一个有9个元素的新数组。我想继续这81个元素。所以基本上是1:9的81 = 1st New array,然后10:18的81 = 2nd New array,然后19:27的81 = 3rd New array,这样的模式将一直持续到81个元素的数组被排序为9个数组,每个数组有9个元素。伪代码例子Array81 = (1 2 3 4 5 6 ................81] For循环:循环array81和创建以下:1 stnewarray = (1 2 3 4 5 6 7 8 9] 2 ndnewarray = 11 12 13 14 15 16 17 18 [10] 3 rdnewarray =[19 20 21日22日23日24日25日26日27日]4 thnewarray =[28 29 30 31 32 33 34 35 36)这将持续到9 thnewarray = (73 74 75 76 77 78 79 80 81) 扎卡里·乔瓦内利 //www.tatmou.com/matlabcentral/profile/authors/18666500 标签:www.tatmou.com, 2005:问题/ 1457239 2021 - 09 - 20 - t22:25:27z 2021 - 09 - 20 - t23:17:46z 为什么矩阵X的结果不显示出来? 我只是想证明,如果x4=0,那么矩阵X’将是[100+0-400+0-500+0],但我只收到了一些危险信号:(,有人知道我在修正它时做错了什么吗?A=[02-10;01-1;1-10;-100]B=[100-500300100]X=inv(A)*B对于x4=0:1:100x'=[-100+x4-400+x4-500+x4]X=X如果X'=X中断结束 伊恩•萨缪尔森 //www.tatmou.com/matlabcentral/profile/authors/14910854 标签:www.tatmou.com, 2005:问题/ 1456964 2021 - 09 - 20 - t13:35:43z 2021 - 09 - 20 - t13:53:11z 使用一半中的一组值和另一半中的另一组值初始化所有行 下面一行代码用于初始化数组的第一行:cA(1,:)=[cA0*ones(1,(N-1)/2+1),Kw/cB0*ones(1,(N+1)/2-1)];然而,我想用这个“代码”初始化数组的所有行。我原以为下面的方法会奏效,但其实不然。cA (:,) = [cA0 * 1 (1 (N - 1) / 2 + 1),千瓦/ cB0 *的(1)(N + 1) / 2 - 1));MatLab抛出了一个错误,它不能识别函数或变量“1”。我如何初始化cA中的所有行用我最初拥有的第一行。 罗伯特Demyanovich //www.tatmou.com/matlabcentral/profile/authors/22629815 标签:www.tatmou.com,2005:Question/1456804 2021 - 09 - 20 - t09:22:10z 2021-09-20T10:41:02Z 从单元格数组中的表中提取值 你好,以下表中存储单元阵列,我们如何访问这些表提取例如一个接一个的值在第一行第一个5细胞,使用这些值来创建一些knid索引的索引和存储单元阵列的第二列?注意:用于创建这个单元格数组的代码如下:idxBkpt =找到(diff ([t.GDALT]) < 0);split_indices = (1 + idxBkpt)进行排序;%begin of blocks BLK = diff([1重塑(split_indices, 1, []) size(t,1)+1]);split = mat2cell(t, blk, size(t,2));结果{k, 2} =分裂; malak奥萨马 //www.tatmou.com/matlabcentral/profile/authors/20681547 标签:www.tatmou.com, 2005:问题/ 1456564 2021 - 09 - 20 - t00:15:57z 2021 - 09 - 20 - t08:58:17z 给出矩阵,用MATLAB进行计算。 我不知道如何在matlab中加上t,没有t值,如何找到矩阵是对称的? yihan王 //www.tatmou.com/matlabcentral/profile/authors/23864342 标签:www.tatmou.com, 2005:问题/ 1456729 2021 - 09 - 20 - t07:15:03z 2021-09-20T07:29:56Z matrix1: matrix2 ? 一个= [1 2 3;4 5 6] b=[1 2;3 4;当我执行a:b时,不管矩阵值是多少,ans总是1这个操作到底做了什么? 别GOKULAPATI //www.tatmou.com/matlabcentral/profile/authors/16460274 标签:www.tatmou.com, 2005:问题/ 1456284 2021-09-19T08:52:19Z 2021-09-20T06:09:32Z 如何修改此代码以将文件夹中的文件读入表? 我正在编写以下代码,它将遍历一些文件夹并读取数据文件作为表,对于k=1:length(theFiles)baseFileName=theFiles(k).name;fullFileName=fullfile(myFolder,baseFileName);t=可读性(完整文件名);%输出=t.输出;%fprintf(1,“正在读取%s\n”,完整文件名);idxBkpt=find(diff([t.GDALT])<0;拆分索引=排序(1+idxBkpt);%块blk的开始=差异([1重塑(分割指数,1,[])大小(t,1)+1]);拆分=mat2cell(t,blk,尺寸(t,2));celldisp(splits);现在结束我正在努力解决的问题是:我想创建一个矩阵,在每行的第一个单元格中,它将存储我正在处理的数据文件的名称,在该行的其余单元格中,它将存储单元格数组“拆分”,有没有有效的方法? malak奥萨马 //www.tatmou.com/matlabcentral/profile/authors/20681547 标签:www.tatmou.com, 2005:问题/ 1456684 2021 - 09 - 20 - t05:54:39z 2021 - 09 - 20 - t05:54:39z 如何写一个函数,执行反卷积来解决x给定的y和h,其中y = h*x(所有列向量)使用linsolve 我知道deconv()函数可以完美地完成它。但是,我想知道是否有人可以用linsolve()编写一个函数来执行反卷积。我尝试过做一个简单的实现,但它似乎不是通用的。函数x = mdeconv(h, y) %反褶积% hT = toeplitz([h(1) zeros(1,length(y)-length(h))], [h(1,length(y)-length(h))]));%x = linsolve(hT, y);x = y / hT;结束 威廉 //www.tatmou.com/matlabcentral/profile/authors/20630272 标签:www.tatmou.com, 2005:问题/ 1456384 2021 - 09 - 19 - t18:05:16z 2021 - 09 - 20 - t03:31:07z 如何将双回路的输出保存为矩阵? for i=1:m for j=1:n A=myfunction(…)如何为每次迭代保存输出A 努尔Bano //www.tatmou.com/matlabcentral/profile/authors/11967560 标签:www.tatmou.com, 2005:问题/ 316509 2016 - 12 - 12 - t10:19:45z 2021 - 09 - 19 - t11:46:42z 用于延迟简单信号的分数延迟滤波器 大家好!:)所以,我想用一个分数延迟滤波器来延迟信号0.075s。所以我得到一个随机矩阵,输入1-10个信号。信号:x=0:0.2:pi;s=sin(x);为了根据我的要求设计分数延迟滤波器,我使用:d=fdesign.fracdelay(0.075,'N',2);hd=设计(d,'lagrange','filterstructure','farrowfd')我的问题是将两者结合起来,所以我的正弦延迟0.075s。那么,有人知道如何解决这个问题吗?善良的马格纳斯354 马格纳斯354 //www.tatmou.com/matlabcentral/profile/authors/9356773 标签:www.tatmou.com, 2005:问题/ 1456104 2021-09-18T20:41:04Z 2021-09-18T22:06:59Z 我有一个矩阵。我不知道怎么从第5行减去第1行,从第6行减去第2行,从第7行减去第3行,从第8行减去第4行。我的代码不能用了。 A =[2.5 3.5 7.5 8.5;…%1 9.5 5.5 6.5 1.5;…%2 2.5 3.5 7.5 8.5;...%3 9.5 5.5 6.5 1.5;…%4 2.5 3.5 7.5 8.5;...%5 9.5 5.5 6.5 1.5;…%6 2.5 3.5 7.5 8.5;…%7 9.5 5.5 6.5 1.5]; %8 for i=1:size(A,1) for j=1:size(A,1)/2 tmp(i,:) = A(i,:)-A(j,:) end % tmp(i,:) = A(i,:)-A(4+j,:) end My code is not working very well. I need a loop that can work for any matrix size. 霍萨姆·阿明 //www.tatmou.com/matlabcentral/profile/authors/18759720 标签:www.tatmou.com, 2005:问题/ 1455979 2021-09-18T15:05:38Z 2021 - 09 - 18 - t15:46:00z 用for循环从方程到矩阵 如何用for循环把方程变成矩阵?例如如果你有这样的:因为我= 1:10 1 * x(我)+ 2 * (i + 1) + 3 * x (i + 2) = y (i)所以,如果我要做这个手工就像我= 1 (1 2 3)* (x x (1) (2) (3)] ' = y(1)和i = 2你会(1 2 3)* (x x(2)(3)(4)]的= y(2)所以我怎么能结构在某种程度上它给了我这样的一个矩阵:[1 2 3 0;0 1 2 3] * [x(1) x(2) x(3) x(4)]' = [y(1);y (2)) Io7 //www.tatmou.com/matlabcentral/profile/authors/23941181 标签:www.tatmou.com,2005:Question/1455794 2021-09-18T06:02:38Z 2021 - 09 - 18 - t15:43:17z 如何解除结构数据的结构? 我想找出数据集中所有行的平均值。但工作区中的数据采用以下格式。设一个数据集。A=<54×10 struct>,其中A的每一行的格式如下:如何找到A的每一行的平均值。 努尔Bano //www.tatmou.com/matlabcentral/profile/authors/11967560 标签:www.tatmou.com, 2005:问题/ 1453834 2021 - 09 - 15 - t15:24:02z 2021-09-18T12:48:30Z 从文本文件中读取数据 你好,什么是一个断指effecient方式读取数据文件的结构列和行,后来让我独立和行分解成更小的组件或部件,能够给每个组件一个唯一的名称,后来很容易提取每个组件。例如,我有这个数据文件,分离过程是根据行(例如:从raw 1到行70 ..从71岁到140岁…)我已经看到了许多使用它们读取数据文件的方法,但我不确定哪一种最适合我的目的,最终在分解这些行之后,我希望能够给每个部分一个唯一的名称。在matlab中是否有一种有效的方法来实现这一目的? malak奥萨马 //www.tatmou.com/matlabcentral/profile/authors/20681547 标签:www.tatmou.com, 2005:问题/ 621078 2020 - 10 - 21 - t09:34:19z 2021 - 09 - 18 - t04:07:29z 将python中的numpy数组转换为matlab中的.mat 我在python中有一个2D numpy数组,我想在matlab中使用'imagesc()'图像这个数组。我试图将数组转换为熊猫DataFrame,然后将其导出为。csv文件,这样我就可以在matlab中加载它。但我觉得有比这更简单的方法。最终我想要的是把我的python数组转换成matlab矩阵。 卡提卡·克里希纳 //www.tatmou.com/matlabcentral/profile/authors/18242308 标签:www.tatmou.com,2005:Question/1453599 2021 - 09 - 15 - t09:31:18z 2021 - 09 - 18 - t02:24:08z 错误时,使用Matlab生成的函数读取文件 你好,我试图ipmort一个数据文件到Matlab使用导入数据工具,然后使用生成函数,但我得到这个错误消息“不够的输入参数。If anyone can help me in fix this Error .... .i attach down the geneated function and the data file i am trying to import function jro19661111 = importfile(filename, startRow, endRow) % importfile从文本文件中导入数值数据作为一个矩阵。% JRO19661111 = IMPORTFILE(FILENAME) %为默认选择从文本文件FILENAME读取数据。% % JRO19661111 = IMPORTFILE(FILENAME, STARTROW, ENDROW) %通过文本文件FILENAME的ENDROW从STARTROW行读取数据。% %示例:% jro19661111 = importfile('jro19661111.001.txt', 1,8541);% %参见TEXTSCAN。% Auto-generated by MATLAB on 2011/09/15 13:23:41 %%初始化变量。if nargin<=2 startRow = 1;endRow =正; end %% Read columns of data as text: % For more information, see the TEXTSCAN documentation. formatSpec = '%6s%10s%10s%10s%10s%*10*s%*13*s%*11*s%*14*s%*14*s%*14s%11s%14s%[^\n\r]'; %% Open the text file. fileID = fopen(filename,'r'); %% Read columns of data according to the format. % This call is based on the structure of the file used to generate this code. If an error occurs for a different file, try regenerating the code from the Import Tool. dataArray = textscan(fileID, formatSpec, endRow(1)-startRow(1)+1, 'Delimiter', '', 'WhiteSpace', '', 'TextType', 'string', 'HeaderLines', startRow(1)-1, 'ReturnOnError', false, 'EndOfLine', '\r\n'); for block=2:length(startRow) frewind(fileID); dataArrayBlock = textscan(fileID, formatSpec, endRow(block)-startRow(block)+1, 'Delimiter', '', 'WhiteSpace', '', 'TextType', 'string', 'HeaderLines', startRow(block)-1, 'ReturnOnError', false, 'EndOfLine', '\r\n'); for col=1:length(dataArray) dataArray{col} = [dataArray{col};dataArrayBlock{col}]; end end %% Close the text file. fclose(fileID); %% Convert the contents of columns containing numeric text to numbers. % Replace non-numeric text with NaN. raw = repmat({''},length(dataArray{1}),length(dataArray)-1); for col=1:length(dataArray)-1 raw(1:length(dataArray{col}),col) = mat2cell(dataArray{col}, ones(length(dataArray{col}), 1)); end numericData = NaN(size(dataArray{1},1),size(dataArray,2)); for col=[1,2,3,4,5,6,7] % Converts text in the input cell array to numbers. Replaced non-numeric text with NaN. rawData = dataArray{col}; for row=1:size(rawData, 1) % Create a regular expression to detect and remove non-numeric prefixes and suffixes. regexstr = '(?.*?)(?([-]*(\d+[\,]*)+[\.]{0,1}\d*[eEdD]{0,1}[-+]*\d*[i]{0,1})|([-]*(\d+[\,]*)*[\.]{1,1}\d+[eEdD]{0,1}[-+]*\d*[i]{0,1}))(?.*)'; try result = regexp(rawData(row), regexstr, 'names'); numbers = result.numbers; % Detected commas in non-thousand locations. invalidThousandsSeparator = false; if numbers.contains(',') thousandsRegExp = '^[-/+]*\d+?(\,\d{3})*\.{0,1}\d*$'; if isempty(regexp(numbers, thousandsRegExp, 'once')) numbers = NaN; invalidThousandsSeparator = true; end end % Convert numeric text to numbers. if ~invalidThousandsSeparator numbers = textscan(char(strrep(numbers, ',', '')), '%f'); numericData(row, col) = numbers{1}; raw{row, col} = numbers{1}; end catch raw{row, col} = rawData{row}; end end end %% Replace non-numeric cells with NaN R = cellfun(@(x) ~isnumeric(x) && ~islogical(x),raw); % Find non-numeric cells raw(R) = {NaN}; % Replace non-numeric cells %% Create output variable jro19661111 = table; jro19661111.YEAR = cell2mat(raw(:, 1)); jro19661111.MONTH = cell2mat(raw(:, 2)); jro19661111.DAY = cell2mat(raw(:, 3)); jro19661111.HOUR = cell2mat(raw(:, 4)); jro19661111.MIN = cell2mat(raw(:, 5)); jro19661111.GDALT = cell2mat(raw(:, 6)); jro19661111.NE8 = cell2mat(raw(:, 7)); malak奥萨马 //www.tatmou.com/matlabcentral/profile/authors/20681547 标签:www.tatmou.com, 2005:问题/ 391445 2018 - 03 - 29 - t13:57:41z 2021 - 09 - 17 - t15:48:57z 我如何从矩阵创建表? 我有一个像这样的矩阵,我想创建一个表格,每个列有一个特定的标题。<>应该如下图所示:请帮助任何人 乔恩格雷 //www.tatmou.com/matlabcentral/profile/authors/12206579