Matlab编程,总是不对clear allclc;number=input('Please enter a number:');pp=number+1;a=0;b=0;i=2;while a==0 || b==0 a=0; b=0; if(pp-1)/4==0 a=1; for i=2:(pp-1) if pp/i==0 break; else

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/09 19:46:29
Matlab编程,总是不对clear allclc;number=input('Please enter a number:');pp=number+1;a=0;b=0;i=2;while a==0 || b==0    a=0;    b=0;    if(pp-1)/4==0        a=1;        for i=2:(pp-1)            if pp/i==0                break;            else

Matlab编程,总是不对clear allclc;number=input('Please enter a number:');pp=number+1;a=0;b=0;i=2;while a==0 || b==0 a=0; b=0; if(pp-1)/4==0 a=1; for i=2:(pp-1) if pp/i==0 break; else
Matlab编程,总是不对
clear all
clc;
number=input('Please enter a number:');
pp=number+1;
a=0;
b=0;
i=2;
while a==0 || b==0
a=0;
b=0;
if(pp-1)/4==0
a=1;
for i=2:(pp-1)
if pp/i==0
break;
else
b=1;
end;
end;
end;
pp=pp+1;

end;
pp
——————————————————————------
题目是输入一个数字,计算出大于该输入数字的最小的质数(pp),同时这个质数可以表示为4*n-1.
运行总是跳不出来,求大神指教
刚刚开始学,写的东西很幼稚.
但是老师什么都没教,就让我们写这种东西.真是苦恼
其实我觉得逻辑没什么问题,但一运行循环就是不停止.

Matlab编程,总是不对clear allclc;number=input('Please enter a number:');pp=number+1;a=0;b=0;i=2;while a==0 || b==0 a=0; b=0; if(pp-1)/4==0 a=1; for i=2:(pp-1) if pp/i==0 break; else
flag = 0;
number=input('Please enter a number:');
num = number;
while flag == 0
num = num+1;
if isprime(num)
if ~mod((num-1),4)
flag = 1;
end
end
end
disp(num)

Matlab编程,总是不对clear allclc;number=input('Please enter a number:');pp=number+1;a=0;b=0;i=2;while a==0 || b==0 a=0; b=0; if(pp-1)/4==0 a=1; for i=2:(pp-1) if pp/i==0 break; else 用matlab画函数频域图,求程序 以下是一个函数的程序,求教将其频域图画出的程序,用matlab编程.clear d1;clear d2;clear d3;clear l1;clear l2;clear all;%输入输出对比图fs=480000;C=2.37;A=1;B=1;G=1;H=1;j1=besselj(1,2.37) >> clear >> a=[1,-2,1.1];b=[1,2];c=1;d=4; >> na=length(a)-1;b=[zeros(1,d-1) b];nb=length(b)-1; >> a初学matlab,在编程时总是出现如下问题,>> clear>> a=[1,-2,1.1];b=[1,2];c=1;d=4;>> na=length(a)-1;b=[zeros(1,d-1) b];nb=length(b)-1;>> aa=con 求问y=2.16*x/(1+1.16*x),matlab的编程怎么写为什么代码这样子写:clear allclcx=linspace(0,1,100);y=2.16*x4/(1+1.16*x);ezplot(x1,y);不对啊 matlab 循环表达式现在想编一小段程序,功能如下:i从1到4循环,对每个d(i)进行多项式赋值,其中a=[1 2 3 4];b=[5 6 7 8];编程如下:for i=1:4 d(i)=sqrt((x-a(i))^2+(y-b(i))^2);end 但总是提示不对,如果不加i就 matlab编程应用题 matlab编程错在哪儿?clear,clcx=-20:1:20;if x>10;y=5;plot(x,y)elseif -10 z=3626/x-3626*y*2/x*14.58 0.51.2 05 用MATLAB编程得出图形初学MATLAB 咋弄也弄不对! matlab编程语言,如图, matlab 级数求和怎么编程 MATLAB编程解决矩阵问题其中A、N为已知矩阵,求矩阵X求达人给出这个方程的详细MATLAB编程, matlab 中 clc 与 clear的差别 求matlab编程 用二分法和牛顿迭代法求根号a X'=AX,A矩阵已知,怎样在matlab里面编程计算呢 matlab中sin函数里面如何输入pi*t?为什么我输入sin(pi*t)总是不对? 小弟总是做不对. matlab编程问题,我的变量的都定义了啊,但是为什么一直出现没有定义的错误啊,求指导clear allclcd1=1;k=5/3;p=k/(2*pi);R=3.5;n1=50;r=5/6;t=0;t1=0.485246;a=0.5;psi=-pi/2:(pi/2/n1):0;for n=1:n1+1psi=psi1(n); x=r*cos(psi);y=r*s 一个关于MATLAB的编程问题,syms h a f2;f2=sym(((sqrt(1.5^2-(1.5-h).^2)+sqrt(1.5^2-(1.5-h+tan(a)).^2))).*8./cos(a));V2=int(f2,h,8*tan(a),h);每次总是会提示错误Error using ==> sym.mapleError,(in limit) invalid limiting pointError in ==