https://uk.mathworks.com/matlabcentral/answers/questions MATLAB答案-新问题 2020 - 10 - 05 - t03:47:01z 标签:uk.mathworks.com, 2005:问题/ 604984 2020 - 10 - 05 - t03:38:10z 2020 - 10 - 05 - t03:47:01z 如何在Matlab中对加速度计excel数据进行FFT ? 你好,我必须对存储在excel中的加速度计数据执行FFT。我有excel文件中的时域数据。我附上了excel文件。 Omkar惜拉 https://uk.mathworks.com/matlabcentral/profile/authors/16234991 标签:uk.mathworks.com, 2005:问题/ 604987 2020 - 10 - 05 - t03:45:03z 2020 - 10 - 05 - t03:45:03z 分分钟到一小时又一分钟 我有一个将分钟转换为小时和分钟的函数。它只使用一次分钟的值(mins)。然而,我想更新变量mins的值几次(例如10次),所以变量输出(测试)也更新了相同的次数。我怎么能做到这一点的例子值变量分钟(60,120,180,240,300)。Hr_min = @(mins) [fix(mins/60) rem(mins,60)];%分钟- >[小时]分钟= 180;% Test Data Test = hr_min(mins) % Test输出 瓦克 https://uk.mathworks.com/matlabcentral/profile/authors/19812601 标签:uk.mathworks.com, 2005:问题/ 600307 2020 - 09 - 26 - t11:30:47z 2020 - 10 - 05 - t03:41:19z 获取通道描述信息失败 以“在”);延迟(1000);并同时在+ CIPSTART = 3, \“TCP \”,\“api.thingspeak.com \”,80 \ r \ n”);延迟(3000);并同时在+ CIPSEND = 3,);并同时(68);并同时(" \ r \ n ");延迟(2000);系列。打印(“GET /渠道/ "); Serial.print(channel_id); Serial.print("/feeds.json?api_key="); Serial.print(mystringchar); Serial.print("&results=0 HTTP/1.1\r\n"); Serial.print("Host:"); Serial.print(DST_IP); Serial.println(); //web link delay(300); unsigned long lastRead = millis(); while (millis() - lastRead < 5000) { while (Serial.available()) { if (Serial.find("description\":\"")) { String message = Serial.readStringUntil('$'); Serial.flush(); Serial.println(message); } } This code was working fine for our production since 3 years but presently we are unable to retrive description .please do suggest us . we are using sim-800c and esp8266-12f 亚莎王妃 https://uk.mathworks.com/matlabcentral/profile/authors/18319635 标签:uk.mathworks.com, 2005:问题/ 604981 2020 - 10 - 05 - t03:35:02z 2020 - 10 - 05 - t03:35:02z Matlab在线rosinit误差 在matlab在线相同的代码,几个月前正在工作,现在显示错误,rosinit命令本身显示此错误-无法创建Python虚拟环境。' / MATLAB / .session /违约/开车。“matlab/R2020b/ros1/glnxa64/venv/bin/python”未找到。请在您的系统中验证Python的安装并重新创建Python虚拟环境,但我正在使用matlab在线而不是在我的系统上,请回答 赛克利须那神 https://uk.mathworks.com/matlabcentral/profile/authors/13491309 标签:uk.mathworks.com, 2005:问题/ 604888 2020 - 10 - 04 - t21:07:47z 2020 - 10 - 05 - t03:31:57z y = kx 我试图重现下面的图形,这是一个函数的图,如:y = kx,变化的“k”和“x”。有人能帮我一下吗? Behnaz Seyedahmadi https://uk.mathworks.com/matlabcentral/profile/authors/10899848 标签:uk.mathworks.com, 2005:问题/ 604975 2020 - 10 - 05 - t03:28:21z 2020 - 10 - 05 - t03:28:21z 使用多个文件的绘图 您好,我正在使用.txt文件运行附加数据(P3。数据运行并生成我想要的数字,问题是我如何绘制某些数据。例如,如果你运行Problem_4m,它将为我所有的txt文件(从P4_N1 - P4N200)生成解决方案,我需要绘万博 尤文图斯制我的N个值从N1, N5, N25, N50, N75, N100, N125, N150, N175,N200,第一个图是N个值和CL(这些数字在工作空间下),第二个图是N个值和CDi(这些值在工作空间下),第三个图是N个值和Gamma(这些值在工作空间下),有没有一种方法将所有.txt文件的结果与上面提供的图结合成一个单一的图 艾迪拉米雷斯 https://uk.mathworks.com/matlabcentral/profile/authors/19177295 标签:uk.mathworks.com, 2005:问题/ 604969 2020 - 10 - 05 - t02:40:05z 2020 - 10 - 05 - t03:21:57z 对于循环问题,使用fprintf输出contour3级别文件。 尝试将contour3输出分离到一个文件(test.txt),其中x,y,z坐标行表示轮廓级别。我目前的问题是,我不知道如何使For循环移动到第二级,它在输出level a中的8个顶点条目后停止。要清楚,每个级别都处于特定的z值。//www.tianjin-qmedu.com/help/matlab/ref/contour3.html#mw_e93c9311-7297-49fb-9003-08716e52168e上面的链接是contour3输出的帮助文件,它有点具体。这些就是我遵循的格式规则。% a= contour3(xx,yy,zz,20) close all;清晰;Load ('a_contour .mat') % n = 1 file1 = fopen('test.txt', 'w');对于n = 1:大小(a,1) - 1 Zcontour = a(1,n);%级别深度。LevNum = a(2,n);% ... ... and the next LevNum % Use Zval / LevNum to start making contour outputs from the: % a - contour3 matrix file1 = fopen('test.txt' , 'a'); fprintf(file1,'#New surface \n reset \n #Contour# \n'); fprintf(file1,'\n First(''point'')}\n'); for m = 2:LevNum +1 % define contour range using m % x, y values go from cols: 2 to 9 fprintf( file1,'create x %.2f y %.2f z %.2f\n',[a(1,m);a(2,m)],Zcontour); end fprintf(file1,'\n End(''point'')}\n'); fprintf(file1,' curve Begin to End delete\n'); n = LevNum + 2; %attempt to move to next Level in contour3 output a end fprintf(file1,'\n surface\n'); fclose(file1); Wthee https://uk.mathworks.com/matlabcentral/profile/authors/13368671 标签:uk.mathworks.com, 2005:问题/ 604972 2020 - 10 - 05 - t03:20:47z 2020 - 10 - 05 - t03:20:47z 如何在图例中显示两条信息并使其美观? 背景:我有一个数据集的测量,基于这些数据我有2线性方程(“本公司”和“线性回归”),就像我在“k——”的传说是“本”我也想表明这条线斜率“m”和拦截“n”为了容易将它与“线性Regresson”第一次尝试:所以,为了让它看起来好我试过我知道,添加一个“|”传说分离从另一个信息,这是“好”,但我想让它看起来一致。所以我尝试了另一种方法。第二次尝试:如果我加了很多空格,让它看起来是对齐的呢?这几乎是完美的,但是,因为每个字母的宽度在开始时是不同的,它不能完美地以这种方式对齐。所以我尝试了另一种方法第三次尝试:这一次是完全不同的,我在这个图中添加了另外3个图,保持图(NaN,NaN,'w.')图(NaN,NaN,'w.')图(NaN,NaN,'w.')然后我添加了我想要对齐在图例图例的第二列中的信息('测量','Friss','线性回归',……",['m = ' num2str(mFriss,'%.1f') "”,n =“num2str (nFriss % .1f)], [' m = ' num2str (m, ' % .1f ')', n = ' num2str(n,'%.1f')],'NumColumns',2)它最终对齐,但正如你所看到的,这两列相隔太远,似乎它们是两个不同的信息,没有任何关系。然后,我想做的是改变两列之间的空间,所以要做到这一点,我应该改变图例符号的宽度,我不知道如何做到这一点:是否有可能改变图例符号的宽度?如果是,我该怎么做? and could I change only some of the symbols and not all of them? Is there a better way to do what I wanted to do? if it is could you share it with me please? Beforehand thank you very much Víctor Díaz Cortés https://uk.mathworks.com/matlabcentral/profile/authors/14499318 标签:uk.mathworks.com, 2005:问题/ 337398 2017 - 04 - 26 - t11:56:33z 2020 - 10 - 05 - t03:19:26z 绘制。mat文件...... 大家好,我想从光谱中画出来。Mat文件,但它给我以下错误。第一个数据参数无效。数据错误(第5行)图('spectrum.mat')但当我准确加载此文件时,它在'工作区框'中加载并在右侧给出“spec 401x2双”值。有人能告诉我为什么我不能画这个“光谱”吗?Mat文件,如果有人告诉我绘制。Mat文件的程序,请友好。顺便说一下,在这个光谱中。mat文件中有两列(例如x轴Frequency和y轴Scale)和401行。谢谢 穆尔塔扎·阿里·汗 https://uk.mathworks.com/matlabcentral/profile/authors/10215026 标签:uk.mathworks.com, 2005:问题/ 364328 2017 - 10 - 31 - t18:47:07z 2020 - 10 - 05 - t03:11:14z 无法重新打开已保存的.fis文件 我有几个.fis文件,我已经继承了我正在工作的项目。其中一些不会打开。其他的打开了,但是当我修改并保存它们时,我无法打开生成的.fis文件。当我尝试时,我得到以下错误文本。错误:字符向量没有正确终止。错误在readfis(第151行)MFName=eval(MFStr((nameStart+1):(nameEnd-1)));计算菜单回调时出现错误。 查尔斯艾略特 https://uk.mathworks.com/matlabcentral/profile/authors/11041976 标签:uk.mathworks.com, 2005:问题/ 603469 2020 - 10 - 02 - t00:34:56z 2020 - 10 - 05 - t03:08:25z 如何找到唯一一对数字在一个向量的方法? 我想把向量中的数字配对成2对,但要找出可能的不同方式。例如:对于数字1到4,在2的集合中可能的组合数量是:n = 1:4;K = 2;我怎么才能得到这些唯一的组合呢?不重复使用这些数字?就像这样:1 2 3 4 1 3 2 4 1 4 2 3基本上就是找出如何将n个数字配对而不重复,每个数字只与另一个数字配对一次。我在想组合的和应该等于(在这个例子中)nchoosek(4,2),但不知道如何让MatLab返回给我的可能性。 史蒂文, https://uk.mathworks.com/matlabcentral/profile/authors/19356773 标签:uk.mathworks.com, 2005:问题/ 604027 2020 - 10 - 02 - t21:29:58z 2020 - 10 - 05 - t03:07:49z AlexNet预训练网络? 你好,我有这个代码,我需要逐个与(vgg16, vgg19, ResNet18和densnet201)交换AlexNet。请问这段代码需要修改哪部分?清除所有;关闭所有;clc;imds = imageDatastore('lung augmented',…“IncludeSubfolders”,真的,…“LabelSource”、“foldernames”);% for JPG图像[imdsTrain,imdsValidation] = splitEachLabel(imds,0.7,'randomize',true);Net = alexnet(); % analyzeNetwork(lgraph) numClasses = numel(categories(imdsTrain.Labels)); % number of classes = number of folders imageSize = [224 224]; % you can use here the original dataset size lgraph = layerGraph(net.Layers); lgraph = removeLayers(lgraph, 'fc8'); lgraph = removeLayers(lgraph, 'prob'); lgraph = removeLayers(lgraph, 'output'); % create and add layers inputLayer = imageInputLayer([imageSize 1], 'Name', net.Layers(1).Name,... 'DataAugmentation', net.Layers(1).DataAugmentation, ... 'Normalization', net.Layers(1).Normalization); lgraph = replaceLayer(lgraph,net.Layers(1).Name,inputLayer); newConv1_Weights = net.Layers(2).Weights; newConv1_Weights = mean(newConv1_Weights(:,:,1:3,:), 3); % taking the mean of kernal channels newConv1 = convolution2dLayer(net.Layers(2).FilterSize(1), net.Layers(2).NumFilters,... 'Name', net.Layers(2).Name,... 'NumChannels', inputLayer.InputSize(3),... 'Stride', net.Layers(2).Stride,... 'DilationFactor', net.Layers(2).DilationFactor,... 'Padding', net.Layers(2).PaddingSize,... 'Weights', newConv1_Weights,...BiasLearnRateFactor 'Bias', net.Layers(2).Bias,... 'BiasLearnRateFactor', net.Layers(2).BiasLearnRateFactor); lgraph = replaceLayer(lgraph,net.Layers(2).Name,newConv1); lgraph = addLayers(lgraph, fullyConnectedLayer(numClasses,'Name', 'fc2')); lgraph = addLayers(lgraph, softmaxLayer('Name', 'softmax')); lgraph = addLayers(lgraph, classificationLayer('Name','output')); lgraph = connectLayers(lgraph, 'drop7', 'fc2'); lgraph = connectLayers(lgraph, 'fc2', 'softmax'); lgraph = connectLayers(lgraph, 'softmax', 'output'); % ------------------------------------------------------------------------- augimdsTrain = augmentedImageDatastore(imageSize,imdsTrain); augimdsValidation = augmentedImageDatastore(imageSize,imdsValidation); options = trainingOptions('sgdm', ... 'MiniBatchSize',64, ... 'MaxEpochs',30, ... % i changed this from 20 to 10 and 5 'InitialLearnRate',0.0001, ... 'Shuffle','every-epoch', ... 'ValidationData',augimdsValidation, ... 'ValidationFrequency',3, ... 'Verbose',false, ... 'Plots','training-progress'); net = trainNetwork(augimdsTrain,lgraph,options) [YPred, probs] = classify(net,augimdsValidation); accuracy = mean(YPred ==imdsValidation.Labels) figure cc = confusionchart (imdsValidation.Labels, YPred); shivan artosh https://uk.mathworks.com/matlabcentral/profile/authors/16817855 标签:uk.mathworks.com, 2005:问题/ 604942 2020 - 10 - 05 - t00:43:49z 2020 - 10 - 05 - t02:58:38z AppDesigner独立桌面应用程序不亮 大家好,你可以想象我是Matlab的新手。我正在努力学习更多关于应用程序设计的日常土木工程工作。但是我想知道为什么说“独立桌面应用程序”的选项是不可点击的?是因为我的大学执照吗?还是我遗漏了什么?很抱歉,这很可能是一个很不好问的问题,但对我这样的新手来说很难:)谢谢你们的理解。爱这个社区 Anilcan谭 https://uk.mathworks.com/matlabcentral/profile/authors/16336649 标签:uk.mathworks.com, 2005:问题/ 604966 2020 - 10 - 05 - t02:27:17z 2020 - 10 - 05 - t02:54:08z 需要帮助翻译步骤从pdf文件到我的matlab代码? 1.我有麻烦试图把附加到pdf文件的步骤到我的matlab代码。2.我试图把它放入命令窗口,以生成我的答案:>> rand('seed',1) >>A=rand(10,10);>>d=my_det(A) >>dd=det(A) >>abs(d-dd)/abs(dd) 3。lu_fac_pp(A)是我在这段代码中调用的另一个函数。函数d = my_det(A) n = size(A,1);p = (1: n) ';Tr = 0 (1,n);s = 0; [L, U, p]= lu_fac_pp(A) for k = 1:n-1 if A(n,n) == 0 det(A)=0; end [r m]=max(abs(A(k:n,k))); m=m+k-1; if (A(m,k)~=0) if (m~=k) A([k m],:)=A([m k],:); p([k m])=p([m k]); end i=k+1:n; A(i,k)=A(i,k)/A(k,k); j=k+1:n; A(i,j)=A(i,j)-A(i,k)*A(k,j); end end if A(n,n) ==0 disp('A is not invertible'); return end L=tril(A,-1)+eye(n,n); U=triu(A); end 丹尼尔·瓦哈卜 https://uk.mathworks.com/matlabcentral/profile/authors/19414415 标签:uk.mathworks.com, 2005:问题/ 426400 2018 - 10 - 27 - t08:10:56z 2020 - 10 - 05 - t02:09:30z Windows 10 Matlab突然打不开 当我在Matlab上工作时,我的电脑死机了(它时不时会死机,这是一台旧的windows HP笔记本电脑),但当我重新启动笔记本电脑时,当前版本的Matlab无法打开:我点击图标,它会短暂闪烁,然后什么都没有发生。以前的版本仍然可以正常工作,所以这并不紧急,但显然我希望能够继续在当前版本上工作。谢谢! 安德鲁•考克斯 https://uk.mathworks.com/matlabcentral/profile/authors/6995662 标签:uk.mathworks.com, 2005:问题/ 283500 2016 - 05 - 10 - t10:33:29z 2020 - 10 - 05 - t02:07:15z 在聚类多光谱图像、剪影值、邓恩指数或戴维斯博尔丁指数时,哪一种算法是最好的(最快的)算法,可以为k个均值找到无聚类? 我使用剪影值进行聚类内聚性评估,但为所有可能的簇的no找到剪影会使它变慢,所以我更想首先找到数据中存在的簇的最佳no,然后使用剪影值进行进一步的簇紧凑性评估 kumud阿 https://uk.mathworks.com/matlabcentral/profile/authors/7612689 标签:uk.mathworks.com, 2005:问题/ 604945 2020 - 10 - 05 - t00:46:53z 2020 - 10 - 05 - t02:04:50z 如何生成非零x (i, j)值使用循环函数1:pop_size? Let c=[10 2 20 11 12 7 9 20 4 14 16 18];S =[15 25 10];D =[5 15 15 15];[m, n] =大小(c);pop_size = 25 gen_iter ii = 1 = 100φ= 1:12:pop_size randi_phi = randperm(计数长度(φ))= 1:长度(φ)数k = randi_phi(计数)i = [1 + mod ((k - 1), m)] j =(1 +国防部((k - 1), n)) x (i, j) = min (s (i), d (j))(我)=年代(i) - x (i, j) (j) = d (j) - x (i, j)结束结束我想找x (i, j),直到循环pop_size = 25但我的数学实验室的代码导致x (i, j) = (m, n) = 0,即使如果循环使用长度φ值x (i, j)或不为零。谁能帮我的数学实验室编码这个。?本文在染色体初始化阶段采用了一种新的遗传算法 默罕默德山姆-西安 https://uk.mathworks.com/matlabcentral/profile/authors/7844581 标签:uk.mathworks.com, 2005:问题/ 604951 2020 - 10 - 05 - t01:05:00z 2020 - 10 - 05 - t02:04:04z 使用while循环分析重复的行 你好,每个人。我有一个疑问:如何比较文件中的7列中的3列?我有一个有7列的数据文件。Data = load('/home/pink/input.txt');文件名=组成(“precipi_ % 05 d_ % 08年d_ % 04 d.dat ',数据(:,7),数据(:1),数据(:,2));Nfiles = numel(文件名);如果K = 1:nfiles;thisfile =文件名(K);fileID = fopen(此文件{1});dados = fread(fileID,[500 500], 'float32'); dados((dados==-99.0))=NaN; fclose(fileID); end However, I need to open each file only once, that is, the file precipi_02000_20140101_0000.dat, for example, can only be opened once. So I thought of doing an if / else for this. If the second line is the same as the first, considering column 1, 2 and 7, skip to the third line. If the third line is different from the previous one, the file will be opened. Then in this case the files will be opened twice considering the part of the file exposed above: precipi_02000_20140101_0000.dat precipi_03000_20140101_0000.dat precipi_04000_20140101_0000.dat I'm trying to do: while ymd (K) == ymd (K==K+1); K = K+1; end K = K-1; where ymd is the first column (20140101), for example. How to use while function to open each file only once?! Thanks! 粉红色的花 https://uk.mathworks.com/matlabcentral/profile/authors/18011377 标签:uk.mathworks.com, 2005:问题/ 427863 2018 - 11 - 04 - t12:15:57z 2020 - 10 - 05 - t02:03:51z 复制一个矩阵到另一个矩阵 我有一个3 * 3的矩阵,我想把它复制到另一个大小为9 * 9的矩阵中,在中心位置a =hyperImage(3,C1(1,1),C2(1,1),C3(1,1));Fenetre = 0 (9, 9);for i=4:6 for j=4:6 Fenetre=repmat(A,1);结束结束 dakhli穆罕默德 https://uk.mathworks.com/matlabcentral/profile/authors/11399481 标签:uk.mathworks.com, 2005:问题/ 479959 2019 - 09 - 11 - t17:19:28z 2020 - 10 - 05 - t02:02:28z Dynare和Matlab Online 是否可以使用Dynare与Matlab Online R2019a?如果是阳性,该怎么办?谢谢你!马库斯 马库斯·阿尔梅达 https://uk.mathworks.com/matlabcentral/profile/authors/16152015 标签:uk.mathworks.com, 2005:问题/ 491996 2019 - 11 - 19 - t21:52:22z 2020 - 10 - 05 - t01:55:21z MATLAB 2019b在Mac OS Catalina上没有响应 我在MacOS Catalina Version 10.15.1上的MacBook AIr上安装了MATLAB 2019b。应用程序在启动时冻结,活动监视器显示应用程序“没有响应”。内存和存储没有问题。在应用程序窗口中没有打印错误消息。请帮忙解决这个问题。谢谢! Viswanath Pasumarthi https://uk.mathworks.com/matlabcentral/profile/authors/16899935 标签:uk.mathworks.com, 2005:问题/ 604840 2020 - 10 - 04 - t18:38:34z 2020 - 10 - 05 - t01:53:41z Matlab解析类后的错误声明 这是我第一次用matlab写东西,但我用其他语言写过。我似乎无法找出是什么原因导致这段代码中的解析错误。我试着做一个流行的模拟类如果某物向任何方向移动的概率相等,在x步后它平均离开了多远。我只是试图让函数“步骤”改变属性“位置”正确取决于什么是随机整数。不知怎么回事,我犯了一个解析错误,我需要帮助找到它!谢谢你!classdef drunk_walking属性stepSize = 1 position = [0 0] end methods function step(self) dire = randi(4);%正X如果可怕== 1 self.position(1) = self.position(1) + 1;%Negative X elseif dire == 2 self.position(1) = self.position(1) - 1;%Positive Y elseif dire == 3 self.position(2) = self.position(2) + 1; %Negative Y elseif dire == 4 self.position(2) = self.position(2) - 1; end end end end expr = drunk_walking; %This line is the parsing error expr.step() disp(expr.position) 卡特科恩 https://uk.mathworks.com/matlabcentral/profile/authors/19709045 标签:uk.mathworks.com, 2005:问题/ 603448 2020 - 10 - 01 - t22:42:50z 2020 - 10 - 05 - t01:53:39z 模拟代表真实实验的图像数据 作为我研究的一部分,我需要通过模拟“假”数据来验证图像捕获和粒子轨迹分析的特定实验方法,其中我可以控制参数。更具体地说,我的任务是:生成多个粒子的随机轨迹;创建模拟点粒子的高斯模糊,其中高斯模糊与我指定的半径参数有关;将高斯模糊粒子离散到与实际实验设置相关的像素分辨率对应的网格中;并将轨迹中的每个时间步输出为像素化图像。我可以轻松地完成步骤1,但我的问题在于步骤2-4。我附上的图片将提供一个有用的图表,可以更好地描述我的目标。蓝色的部分是我想要输出的。实验设置包括一个显微镜自上而下地观察平面上粒子的轨迹,所以我的“假数据”图像需要代表这个设置。我花了很长时间研究Matlab的成像功能; however, either due to my ignorance of imaging or to my ignorance of Matlab, I have been unable to come up with an approach that meets my needs. I appreciate any input anyone can offer. 瑞安Muoio https://uk.mathworks.com/matlabcentral/profile/authors/15899033 标签:uk.mathworks.com, 2005:问题/ 59711 2013 - 01 - 23 t22:49:32z 2020 - 10 - 05 - t01:48:47z SimMechanics Link with Solidworks问题 我已经安装了SimMechanics Link,我运行install_addon成功,我运行smlink_linksw成功,我勾选了Solidworks Tools中的SimMechanics Link -> Add-Ins,按下OK,但SimMechanics Link菜单无法添加到SW Matlab, Simulink, SimMechanics和SimMechanics Link都是2012b Solidworks是Premium 2012任何建议/帮助将非常感谢万博1manbetx 广告 https://uk.mathworks.com/matlabcentral/profile/authors/1463880 标签:uk.mathworks.com, 2005:问题/ 604933 2020 - 10 - 04 - t23:22:41z 2020 - 10 - 05 - t01:48:03z MATLAB评分器:你要求的作业找不到。 当我试图将一个旧课程的作业复制到一个新创建的课程时,我总是在Matlab Grader中得到这个错误。在过去的几周里,我能够做到这一点,但现在它已经停止工作了。有人知道怎么解决这个问题吗? Suyog Chaudhari https://uk.mathworks.com/matlabcentral/profile/authors/8303196 标签:uk.mathworks.com, 2005:问题/ 604912 2020 - 10 - 04 - t22:25:42z 2020 - 10 - 05 - t01:41:52z 如何创建一个朗伯(扩散)球 大家好,我需要在Matlab中生成一个朗伯球面的图像。朗伯曲面与镜面的不同之处在于,无论入射角如何,朗伯曲面都能从各个方向反射光线。我看到存在函数R = diffuse(Nx,Ny,Nz,S),其中Nx,Ny和Nz是曲面的法向量分量。问题是我需要生成一个球体。我所写的代码是:[x,y,z] = sphere(100);figure h = surf(x,y,z,'FaceColor','w','FaceAlpha',1);集(h,‘edgecolor’,‘没有’);轴= ax = gca;集(ax,“颜色”、“k”);光(“位置”,[1 0 0],“风格”,“无限”,“颜色”,“w”); lighting gouraud but the result I get is: 胭脂Buonagura https://uk.mathworks.com/matlabcentral/profile/authors/15080615 标签:uk.mathworks.com, 2005:问题/ 604954 2020 - 10 - 05 - t01:05:49z 2020 - 10 - 05 - t01:41:03z 利用rand函数生成某一参数的数字 我如何使用rand()函数生成两个具有10000个元素范围在5和-5之间统一的向量?谢谢你! JoyAnne Jernigan https://uk.mathworks.com/matlabcentral/profile/authors/19151090 标签:uk.mathworks.com, 2005:问题/ 455550 2019 - 04 - 10 - t14:23:11z 2020 - 10 - 05 - t01:29:31z 用贝叶斯优化方法优化函数 嗨,我正在处理一个简单的例子,试图理解贝叶斯优化。假设我想要找到2维Rastrigin函数的最小值(它在坐标(0,0)处有一个全局最小值)。% Rastrigin函数fun = @(x,y)重塑(rastriginsfcn([x(:))/10,y(:)/10]),size(x));fsurf(fun,[-30 30],'ShowContours','on') title('rastriginsfcn([x/10,y/10])') xlabel('x') ylabel('y')现在,我想使用贝叶斯优化来最小化这个函数,但我似乎不能让它工作。这是我使用的代码。%贝叶斯优化变量X1 = optimizableVariable('x',[-30 30]);X2 = optimizableVariable('y',[-30 30]);vars = [X1,X2];%函数优化乐趣= @(x)rastriginsfcn(x./10);results = bayesopt(fun,vars,' accesstionfunctionname ','expected-improvement-plus');这段代码只是给了我一个错误“未定义的函数'rdivide'输入参数类型为'表'.”。 蓬托斯Vikstal https://uk.mathworks.com/matlabcentral/profile/authors/9099226 标签:uk.mathworks.com, 2005:问题/ 598354 2020 - 09 - 23 - t07:23:18z 2020 - 10 - 05 - t01:11:28z 当您指定错误栏线型时,如何将它们移植到图例中? 我发现了一个很好的解释,如何在一个错误栏的错误栏中强制改变线型,但我在我的R2019a环境中遇到了一个必然的障碍:当我在我的情节中使用该解决方案调用图例时,颜色和错误栏形状被移植了-但我使用链接技术编辑的线型没有。如何使图例反映修改后的错误条?H1 = errorbar(1,1,0.3,0.2,'or');xlim([0 5]) ylim([0 3]) h1.Bar。LineStyle = 'dashdot' hold on h2 = errorbar(3,1.4,0.1,0.4,'ok');h2.Bar。LineStyle = '虚线' hold off hl = legend('VarName1','VarName2');请注意,上面的代码生成的图显示了置信区间的不同线型,但这些都没有反映在图例中,图例显示了应该使用“dashdot”或“虚线”的实线。我还会注意到,我可以hack在适当的行和标记(尽管水平而不是垂直,如errorbar令牌)通常的工作方法hold on;Plot(期望风格,但在期望窗口外)… ; actual errorbar calls ; hold off. But doing it this way loses the errorbar tokens, which I wanted to keep (assuming the linestyles showed well enough in the vertical space allotted). 丹尼尔 https://uk.mathworks.com/matlabcentral/profile/authors/3828155 标签:uk.mathworks.com, 2005:问题/ 42690 2012 - 07 - 03 - t23:42:15z 2020 - 10 - 05 - t00:50:38z 警告:名称不存在或不是目录 每次我启动MATLAB时,我都会收到这样的消息:警告:名称不存在或没有目录:C:\POSTDOC\vlfeat\toolbox\mexw32。C:\POSTDOC\vlfeat\toolbox\special目录不存在。C:\POSTDOC\vlfeat\toolbox\sift目录不存在或名称不存在。C:\POSTDOC\vlfeat\toolbox\plotop目录不存在。C:\POSTDOC\vlfeat\toolbox\mser目录不存在。C:\POSTDOC\vlfeat\toolbox\misc目录不存在。C:\POSTDOC\vlfeat\toolbox\kmeans目录不存在。C:\POSTDOC\vlfeat\toolbox\imop目录不存在。C:\POSTDOC\vlfeat\toolbox\geometry目录不存在或名称不存在。C:\POSTDOC\vlfeat\toolbox\aib目录不存在。 Warning: Name is nonexistent or not a directory: C:\POSTDOC\vlfeat\toolbox. Warning: Name is nonexistent or not a directory: xml_toolbox. Warning: Name is nonexistent or not a directory: C:\POSTDOC\Hand_Mathias\videoIO. How do I fix this? 乔纳森 https://uk.mathworks.com/matlabcentral/profile/authors/3331998 标签:uk.mathworks.com, 2005:问题/ 604477 2020 - 10 - 03 - t21:58:04z 2020 - 10 - 05 - t00:39:04z fmincon MATLAB函数使用梯度 我想用MATLAB 'fmincon'函数得到函数的最小值,其中从给定矩阵导出的第一个特征值是我的目标函数。我写了/提供了它的目标函数,但它太长了,不能放在代码中。我写了下面的代码,但我被困在继续。我发现的错误是:错误使用symengine无法转换表达式为双数组。我想知道我能不能得到帮助?谢谢。options = optimoptions('fmincon','GradObj','on');x = fmincon (@myfun [1,1 ],[],[],[],[],[- 2 2][2,2],[],选项)函数(f, g) = myfun (x)信谊(x1, x2);% 4 × 4矩阵,其中两个变量C=[1 2 x1 4;…1/2 1 3 x2;… 1/x1 5 1 3/2;... 1/4 1/x2 2 1]; f1 = eig(C); % calculates eigenvalues f=f1(1); % the first eigenvalue if nargout > 1 % gradient required % Calculate partial derivatives of f g(1) = diff(f,x1); g(2) = diff(f,x2); g = double([g(1);g(2)]);% data type double end end https://uk.mathworks.com/matlabcentral/profile/authors/16974472 标签:uk.mathworks.com, 2005:问题/ 597682 2020 - 09 - 22 - t05:14:36z 2020 - 10 - 05 - t00:35:58z 交叉验证改进 嗨,我只是想提高交叉验证的结果。所以,我赞同@Greg Heath的建议,使用多个网络来改善交叉验证结果。//www.tianjin-qmedu.com/matlabcentral/answers/130702-neural-network-k-fold-cross-validation a.对于i =1:k中的每个i,设计多个由随机初始权值分配而不同的网络。丢弃那些性能较差的和平均性能的其余的是这个代码吗?清除所有;关闭所有;CLC计数器=0对于h= 5:20对于j= 5:20 %%输入文件xp =预测;Xt = table2array(predictors);x= xt' % input t = response' % target trainFcn = 'trainbr';%缩放共轭梯度反向传播。 hiddenLayerSize = [h,j] net = fitnet(hiddenLayerSize, trainFcn) sum_rmse =0 fid=fopen('sum-r.txt','w') KFolds = 10 % K value cvp = cvpartition(size(response, 1), 'KFold', KFolds) %gernater cvp for i= 1:KFolds trainIdx =cvp.training(i); % index of training data testIdx = cvp.test(i); % index of validation data trInd=find(trainIdx) testInd=find(testIdx) xtrain=x(:,trainIdx); ytrain=t(:,trainIdx); xtest=x(:,testIdx); ytest=t(:,testIdx); net.layers{1}.transferFcn ='tansig'; % logsig net.layers{2}.transferFcn ='tansig'; net.layers{3}.transferFcn ='purelin'; net.divideFcn = 'divideind'; net.divideParam.trainInd=trInd; net.divideParam.testInd=tstInd; net.trainParam.showWindow = 0 net.performFcn = 'mse' % MSE %rng('default') nets{i} = train(net,xtrain,ytrain) % trains a network net according to net.trainFcn and net.trainParam. tr: returns a training record end %% multiple nets for i= 1: KFolds neti=nets{i} yPred = neti(xtest) ypt=neti(xtrain) y = neti(x) % test the molde net % Estimate the targets using the trained network. Train_RMSE = sqrt(sum(( ypt - ytrain ).^2) / numel(ytrain)) %da = y-t; vrmse = sqrt(sum((yPred-ytest).^2) / numel(ytest)) train_t(i)=Train_RMSE ttrr(i)=vrmse R= corrcoef(ytest,yPred) Rv(i)=R(1,2) %avrg_rmse = mean(testrmse) trmse= mse(neti,ytest,yPred) sum_rmse = sum_rmse +vrmse counter=counter+1 figname = strcat(num2str(counter),'.mat') save(figname); fprintf(fid,'%6.2f %12.2f\n\n',sum_rmse/10); %plotregression(yTest,yPred,'Test') end fclose(fid); average_rmse(h,j)=sum_rmse/10; %accuracy=mean(tata) cvrmse(h,j)=mean(ttrr) ttrmse(h,j)=mean(train_t) R_value(h,j) = mean(Rv) end end R_value=R_value' ttrmse= ttrmse' cvrmse= cvrmse' save ('test.txt','cvrmse','-ascii') save('train.txt','ttrmse','-ascii') save('r.txt','R_value','-ascii') 羌王 https://uk.mathworks.com/matlabcentral/profile/authors/13481503 标签:uk.mathworks.com, 2005:问题/ 78363 2013 - 06 - 07 - t16:03:11z 2020 - 10 - 05 - t00:34:37z 3D线的最佳贴合 我在excel中有大约50000个点,x,y,z数据分布在3列中。我成功地创造了一个最合适的平面。(通过创建一个以逗号分隔的文件,导入它,将每一列设置为变量,然后使用SFTOOL函数。当我选择x=1和y=1的多项式平面时,这给了我一个通过数据的最佳拟合平面。我不能做的是在这些数据中创建一条最合适的线。这条线一定是一条直线,我想知道这条线的参数方程。如果有人能建议我(一个完全的matlab初学者)如何做到这一点,我将非常感激。非常感谢kanai 金井 https://uk.mathworks.com/matlabcentral/profile/authors/4355314 标签:uk.mathworks.com, 2005:问题/ 604885 2020 - 10 - 04 - t21:04:40z 2020 - 10 - 05 - t00:05:34z 用户提供的适应度函数评估失败。GA不能继续。 嗨,大家好,我想知道是否有人可以帮助我以下错误,我在GA收到如下:clc清除所有rng默认nvars = 24;popSize = 48;据nvar磅= 1 (1);Lb (1:24) = 1;Ub = ones(1,nvars);Ub (1:24) = 24;intCon = 1:24;options = optimoptions('ga','UseParallel', true, 'UseVectorized', false, 'PopulationSize', popSize,'PlotFcn',@gaplotrange);[x,fval,exitflag,output,population,score] =…ga (@objective,据nvar ,[],[],[],[], 磅,乌兰巴托,[],intCon选项); FileName=['_Results_nvars_',num2str(nvars),'_popsize_',num2str(popSize),'_i',num2str(i)]; save(FileName) [Q_Total_cost,Qsystem_total_heat, Qsystem_total_cool] = building_model(x) While I'm receiving the follwoing errors: Caused by: Failure in user-supplied fitness function evaluation. GA cannot continue. Failure in initial user-supplied fitness function evaluation. GA cannot continue. Thank you so much in advance! 默罕默德·达巴格 https://uk.mathworks.com/matlabcentral/profile/authors/10917011 标签:uk.mathworks.com, 2005:问题/ 604906 2020 - 10 - 04 - t21:55:04z 2020 - 10 - 04 - t23:58:53z 对于给定的数据,我应该使用哪个函数来生成加权最小二乘拟合直线? 我有一组数据,我使用以下代码生成:x = linspace(- 10,10,20);斜率= 1.5;截距= -1;noiseAmplitude = 15;y =斜率。* x +截距+噪声振幅* rand(1,长度(x));我想为上述数据点生成一条加权线性最小二乘拟合回归线。我没有权重矩阵,所以我可以使用公式w(I) = 1/方差(I)^2或任何其他MATLAB函数可以用来生成权重矩阵的默认公式。我不知道如何生成这个矩阵并确定它的对角线,然后在数据中拟合一条回归线,MATLAB中有没有一个函数可以帮助我实现这一点? Vihaan Misra https://uk.mathworks.com/matlabcentral/profile/authors/19825404 标签:uk.mathworks.com, 2005:问题/ 604939 2020 - 10 - 04 - t23:29:57z 2020 - 10 - 04 - t23:55:01z 拟合非线性一维数据的曲线 你好,我有一个一年每月的降雨量数据,它是与月份的二次元。我想要得到它的近似方程。我尝试了Excel和其他选项,结果也不错,但我在想MATLAB是否能给我一个更精确的方程。在这之后,我将用这个方程来计算另一个变量。以下是每月的数据。我只是想用曲线来拟合它然后得到方程供我以后使用。非常感谢。18.92、21.6、27.4、43.07、85.66、230.12、347.02、289.74、197.32、95.32、39.5、19 辛格的阿布 https://uk.mathworks.com/matlabcentral/profile/authors/13914225 标签:uk.mathworks.com, 2005:问题/ 604921 2020 - 10 - 04 - t22:55:38z 2020 - 10 - 04 - t23:52:42z Fprintf表未对齐 我的fprintf表有两个数字,我似乎无法修复。这是我的工作台= [r' c' a' s' v'];fprintf('%5.2f\t%5.3f\t%5.1f\t%5.4f\t%5.3f\n',表')这是我的问题的结果2.50 15.708 19.6 78.5398 65.450 2.89 18.151 26.2 104.8749 100.991 3.28 20.595 33.8 135.0109 147.512如何使它看起来像这样?2.50 15.708 19.6 78.5398 65.450 2.89 18.151 26.2 104.8749 100.991 3.28 20.595 33.8 135.0109 147.512 Kalpha.mc https://uk.mathworks.com/matlabcentral/profile/authors/19284641 标签:uk.mathworks.com, 2005:问题/ 603937 2020 - 10 - 02 - t17:17:54z 2020 - 10 - 04 - t23:46:21z 在Matlab中寻找一个非常快速的根查找方法 我试图在Matlab中解决如下方程ai, bi和ci是长度为10的向量,这些向量在代码中发生变化。这段代码必须执行超过100万次。求x的方法一定很快。我尝试了以下代码:方法1:s=tf('s');%传递函数sys=0;对于i=1:10 sys =sys+a(i)/(s*b(i)+c(i));End [roots1] = zpkdata(sys,'v');在本例中,for循环需要0.1秒在我的PC上完成,[root] = zpkdata(sys,'v');执行时间不到0.005秒。因此,在由zpkdata求解之前准备方程sys需要很长时间,在实际情况下需要运行一百万次。表面上的向量化操作不适用于'tf'参数类型。接下来,我检查了下面的方法:方法二:syms x sys=sum(a./(x*b+c)); [roots1]=vpasolve(sys,x) This symbolic method was again slow and took 0.13 seconds to get executed. Do you know any fast method suitable for my case? Or, do you know a way to prepare sys more quickly in method 1? Many tnx. Behnam https://uk.mathworks.com/matlabcentral/profile/authors/3748660 标签:uk.mathworks.com, 2005:问题/ 604927 2020 - 10 - 04 - t23:12:52z 2020 - 10 - 04 - t23:41:49z 如何将情节分成几个月? 我有一个8760个数字的数组,由一年中的每个小时的一个数据点组成。x轴不是以小时(1-8760)分隔的,我怎么能把它改为月?为每个月创建一个变量,并从一年的相应时间,然后结合所有12个图工作吗? 德文·冯·利希滕斯坦 https://uk.mathworks.com/matlabcentral/profile/authors/10768985 标签:uk.mathworks.com, 2005:问题/ 604924 2020 - 10 - 04 - t23:03:44z 2020 - 10 - 04 - t23:39:14z 含正切的多项式方程 我要找到一个包含正切的多项式方程的根。像x*1.4 - atan(0.28*x)=37.5我不知道如何写代码来在上面的方程中找到x。 米娅有限扩散 https://uk.mathworks.com/matlabcentral/profile/authors/19825770 标签:uk.mathworks.com, 2005:问题/ 603493 2020 - 10 - 02 - t01:49:45z 2020 - 10 - 04 - t23:35:52z 不能导入numpy或其他Python库 我试图使用matlab包装一个Python库,需要numpy,以及一些其他依赖。我在这台计算机上没有管理员权限(因此不能使用pip或其他协议来安装numpy),必须在用户空间而不是系统空间上安装这些库。我通过从github下载numpy库开始了这个过程。接下来,我添加了下载numpy的路径。然后我使用py.importlib.import_module()参数'numpy',甚至numpy的完整位置,两次都收到一个错误:错误使用<冻结importlib>_find_and_load_unlocked(第953行)Python错误:ModuleNotFoundError: No模块命名为'/home/brian/Packages/numpy'错误在<冻结importlib>_find_and_load(第971行)错误在<冻结importlib>_gcd_import(第994行)错误在__init__>import_module(第126行)返回_bootstrap。我不确定我在这里做的事情是正确的,并且想知道我做错了什么,或者是否有替代方案可以解决我的问题。 布莱恩·巴里 https://uk.mathworks.com/matlabcentral/profile/authors/11134143 标签:uk.mathworks.com, 2005:问题/ 604936 2020 - 10 - 04 - t23:29:44z 2020 - 10 - 04 - t23:29:44z 编码电压范围函数 我一直在尝试设计一个代码,在电路中给出LDR的电压范围输出,但我很难想出一个有意义的函数,并给出有效的输出。有没有人设计了一个他们愿意分享的功能? 吠陀经Surapaneni https://uk.mathworks.com/matlabcentral/profile/authors/18435221 标签:uk.mathworks.com, 2005:问题/ 604918 2020 - 10 - 04 - t22:50:18z 2020 - 10 - 04 - t23:27:14z 如何找出所有大于某一列的数然后是所有列的数 我需要一些帮助来了解如何使用find来确定一列中大于x的所有数字。示例y =[1 5 9 13 2 6 10 14 3 7 11 15 4 8 12 16]在第2列中查找所有等于或大于7的数字答案应该是7,8我有这个T = find(y >=x)但这给了你整个表格。 Kalpha.mc https://uk.mathworks.com/matlabcentral/profile/authors/19284641 标签:uk.mathworks.com, 2005:问题/ 604633 2020 - 10 - 04 - t10:38:28z 2020 - 10 - 04 - t23:25:59z 绘制音调频率 我正在创造声音。我已经创建了音调频率,但我需要在图表(例如,plot)上显示它,但它一直给我错误,当使用:plot(s1+s2);我做错了什么?前两个图没有给出任何结果,都是蓝色的。图次要情节(3、1、1);情节(t, s1);xlim ([0 1 e + 3]);网格次要情节(3、1、2);情节(t, s2);xlim ([0 1 e + 3]); grid subplot(3,1,3); plot(t, s1 + s2); xlim([0 1E+3]); grid 假名 https://uk.mathworks.com/matlabcentral/profile/authors/19353641 标签:uk.mathworks.com, 2005:问题/ 604930 2020 - 10 - 04 - t23:14:20z 2020 - 10 - 04 - t23:14:20z 状态空间表示不正确 纠结于家庭作业问题。问题是,我的代码是q= 1 *10^-9;M = 1 *10^-6;g = (0, 0, -1.6);E = [1.23, 0, 10];B=[0;0;36.13 * 10^-6];v = 3.2;从= [0,0,0;v * cosd (45); 0; v *信德(45);0];= (0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, (q / m) * B (3), (q / m) * (2), 0, 0, 0, 0, (q / m) * B (3), 0, (q / m) * B (1), 0, 0, 0, 0, (q / m) * (2), (q / m) * B (1), 0, 0, 0, 0, 0, 0, 0, 0, 0);B = [0, 0, 0; E (q / m) * (1), (q / m) * E (2), (q / m) * E (3), 1]; x_dot=(A*x_0)+B My answers are coming out incorrect. Where is the error? 将斯蒂芬 https://uk.mathworks.com/matlabcentral/profile/authors/11893784 标签:uk.mathworks.com, 2005:问题/ 604525 2020 - 10 - 04 - t01:06:33z 2020 - 10 - 04 - t23:07:01z 求解有不等式约束的线性方程组 我需要解一个方程组(dF1-dF8),其中每个变量都有上界和下界。我挣扎着说至少,我知道答案可能是使用lsqlim,但我不确定如何实现。如果有人有一些建议,将不胜感激 诺亚阿特金森 https://uk.mathworks.com/matlabcentral/profile/authors/19815977 标签:uk.mathworks.com, 2005:问题/ 604915 2020 - 10 - 04 - t22:41:37z 2020 - 10 - 04 - t23:01:45z 如何将命令提示符嵌入到mlapp中? 我想在mlapp中嵌入一个命令提示符。基本上,在我自己的自定义mlapp中重新创建命令窗口。我想让usr在这个控制台内接收指令和通知,我还使用tcp连接来运行python脚本,所以最好不要为所有这些交互弹出单独的窗口。这是否需要一些重要的MATLAB-java后端编程?或者2020b AppDesigner有内置功能吗? 杜米尼克Mattioli https://uk.mathworks.com/matlabcentral/profile/authors/3462816 标签:uk.mathworks.com, 2005:问题/ 604903 2020 - 10 - 04 - t21:34:11z 2020 - 10 - 04 - t22:57:18z 多位传奇人物换位 嗨! !我有一个问题,在一个条件内绘图图例,最后一个条件重置或叠加在最后一个我的代码是.....如果(exist ('blockx') == false) %disp('blockx未初始化');Else blockx = blockx(~all(blockx == 0,2),:);cdlx = plot3 (blockx (:, 2), blockx (:, 3), blockx(:, 4),‘莫’,‘MarkerSize’,深圳,…“MarkerEdgeColor”、“m”,…“MarkerFaceColor”,“m”);传奇(cdlx Block_X,“位置”,“东北”);End hold on if(exist ('blocky') == false) %disp('blocky未初始化');Else blocky = blocky(~all(blocky == 0,2),:); cdly=plot3(blocky(:,2),blocky(:,3),blocky(:,4),'bo','MarkerSize',sz,... 'MarkerEdgeColor','b',... 'MarkerFaceColor','b'); legend(cdly,'Block_Y','Location','northeast'); end hold on if(exist ('blockz') == false) %disp('blockz is not initialized'); else blockz = blockz(~all(blockz == 0, 2),:); cdlz=plot3(blockz(:,2),blockz(:,3),blockz(:,4),'go','MarkerSize',sz,... 'MarkerEdgeColor','g',... 'MarkerFaceColor','g'); legend(cdlz,'Block_Z','Location','northeast'); end hold on % if ~exist(cdlz) % % end if(exist ('encast') == false) %disp('encast is not initialized'); else encast = encast(~all(encast == 0, 2),:); cdlxyz=plot3(encast(:,2),encast(:,3),encast(:,4),'rs','MarkerSize',sz,... 'MarkerEdgeColor','r',... 'MarkerFaceColor','r'); legend(cdlxyz,'encastrement','Location','northeast'); end hold on if(exist ('blockxz') == false) %disp('blockxz is not initialized'); else blockxz = blockxz(~all(blockxz == 0, 2),:); cdlxz=plot3(blockxz(:,2),blockxz(:,3),blockxz(:,4),'yo','MarkerSize',sz,... 'MarkerEdgeColor','y',... 'MarkerFaceColor','y'); legend(cdlxz,'Block_XZ','Location','northeast'); end hold on if(exist ('blockxy') == false) % disp('blockxy is not initialized'); else blockxy = blockxy(~all(blockxy == 0, 2),:); cdlxy=plot3(blockxy(:,2),blockxy(:,3),blockxy(:,4),'co','MarkerSize',sz,... 'MarkerEdgeColor','c',... 'MarkerFaceColor','c'); legend(cdlxy,'Block_XY','Location','northeast'); end hold on if(exist ('blockyz') == false) %disp('blockyz is not initialized'); else blockyz = blockyz(~all(blockyz == 0, 2),:); cdlyz=plot3(blockyz(:,2),blockyz(:,3),blockyz(:,4),'ko','MarkerSize',sz,... 'MarkerEdgeColor','k',... 'MarkerFaceColor','k'); legend(cdlyz,'Block_YZ','Location','northeast'); end hold on need some help and thanks alize beemiel https://uk.mathworks.com/matlabcentral/profile/authors/18987795 标签:uk.mathworks.com, 2005:问题/ 604819 2020 - 10 - 04 - t17:52:53z 2020 - 10 - 04 - t22:50:09z 基于r的积分(数值积分) 亲爱的所有我想使用积分(数值积分)基于r为W下面的代码:clc清除所有m=9;= 1;U =[3.8317 7.0156 10.1735 13.3237 16.4706 19.6159 22.7601 25.9037 29.0468];syms r YY1 = 0 (1,m,'sym');对于j=1:m yy1 = 0 (1100,'sym');Yy0 = 0 (1100,'sym');因为我= 1:10 0 yy0 (i) =(((1) ^(张))* ((((u (j)) / a) * r) ^(2 *(张))))/((2 ^(2 *(张)))*((阶乘(张))^ 2));yy1 (i) =(((1) ^(张))/((阶乘(张))*(阶乘(i)))) * (((u (j)) * r) / 2) ^(2 *(张)+ 1);结束YY1 (j) =总和(YY1);YY0 (j) =总和(YY0); W(j)=((YY1(j)/r)*YY0(j)); end as it is obvious i have m=9 W that is base on r for diffrent u i want to use numerical integration base on r in interval of 0 to 1 as i read matlab help for useing integral i should make function but i dont know to make function i really appreciate if u could help me 萨因hashemi https://uk.mathworks.com/matlabcentral/profile/authors/11613864 标签:uk.mathworks.com, 2005:问题/ 604876 2020 - 10 - 04 - t20:48:50z 2020 - 10 - 04 - t22:40:46z 代码正在运行,但没有弹出在我的工作空间? 在我的命令窗口,它说lab4输入一个分数(-1停止):ctA = 0;%填入A等级ctB = 0的数量;%填入B等级的数量ctC = 0;%填入C等级的数量ctD = 0;%填入D个等级的数量ctF = 0;填入F个分数的数量d = input('输入一个分数(-1 to stop):);分数= [];d ~= -1 scores = [scores d] d = input('输入一个分数(-1 to stop): ');end for i =1:length(scores) %值i的长度if (scores(i) >= 90) %输入if值小于或等于90 ctA = ctA + 1%多少个a分数= [scores, i];* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * %store the # of Bs in to score elseif (scores(i) >=70) %input if value is less than or equal to 70 ctC = ctC + 1 % how many Cs scores= [scores i]; %store the # of Cs in to score elseif (scores(i) >=60) %input if value is less than or equal to 60 ctD = ctD + 1 scores= [scores i]; elseif (scores(i) <60) ctF = ctF + 1 scores= [scores i]; end end %displaying grades disp("# of As: " + ctA); disp("# of Bs: " + ctB); disp("# of Cs: " + ctC); disp("# of Ds: " + ctD); disp("# of Fs: " + ctF); 南希·罗伯斯 https://uk.mathworks.com/matlabcentral/profile/authors/19302218