matlab公式编辑,帮找错function [ y ] = JD( x,m,t0,p)%UNTITLED3 Summary of this function goes here% Detailed explanation goes hereb1=7*m*sin(-3.7*p+5.45);b2=17.25*m*sin(1.76*p-1.77);b3=18.9*m*sin(-2.19*p+3.866);w=9.35*t0-(18*p)/(1000*pi);v=1500-
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/27 10:20:45
matlab公式编辑,帮找错function [ y ] = JD( x,m,t0,p)%UNTITLED3 Summary of this function goes here% Detailed explanation goes hereb1=7*m*sin(-3.7*p+5.45);b2=17.25*m*sin(1.76*p-1.77);b3=18.9*m*sin(-2.19*p+3.866);w=9.35*t0-(18*p)/(1000*pi);v=1500-
matlab公式编辑,帮找错
function [ y ] = JD( x,m,t0,p)
%UNTITLED3 Summary of this function goes here
% Detailed explanation goes here
b1=7*m*sin(-3.7*p+5.45);
b2=17.25*m*sin(1.76*p-1.77);
b3=18.9*m*sin(-2.19*p+3.866);
w=9.35*t0-(18*p)/(1000*pi);
v=1500-3000*p/pi;
z=(6*p)/(5*pi)+0.8;
for i=1:length(x);
t(i)=(x(i)+v)*w; %x(i),t(i)为向量的第i个元素
y1=55*m*p-6.25*m*p*cos(t)+b1*sin(t)+b2*cos(2*t)+b3*sin(2*t);
y2=exp(0.2*sin(0.0007*x))/z;
y=y1.*y2;
end
原公式
matlab公式编辑,帮找错function [ y ] = JD( x,m,t0,p)%UNTITLED3 Summary of this function goes here% Detailed explanation goes hereb1=7*m*sin(-3.7*p+5.45);b2=17.25*m*sin(1.76*p-1.77);b3=18.9*m*sin(-2.19*p+3.866);w=9.35*t0-(18*p)/(1000*pi);v=1500-
我猜测你是想对y的计算中采用矩阵的乘法.则不需要for循环了.
矩阵乘除是.*与./.把y的计算式微微修改就好.程序如下:
function y=JD(x,m,t0,p)
%UNTITLED3 Summary of this function goes here
% Detailed explanation goes here
b1=7*m*sin(-3.7*p+5.45);
b2=17.25*m*sin(1.76*p-1.77);
b3=18.9*m*sin(-2.19*p+3.866);
w=9.35*t0-(18*p)/(1000*pi);
v=1500-3000*p/pi;
z=(6*p)/(5*pi)+0.8;
% for i=1:length(x);
t=(x+v).*w; %x(i),t(i)为向量的第i个元素
y1=55*m*p-6.25*m*p.*cos(t)+b1.*sin(t)+b2*cos(2*t)+b3*sin(2*t);
y2=exp(0.2*sin(0.0007*x))/z;
y=y1.*y2;
我试了下,计算没有问题.如果你一定要用for循环,则只需要把你的程序中y1,y2的计算式中的t与x全部换成t(i)和x(i).就不会报错.